Subject: Re: bug#62767: 29.0.90; [PATCH] *lisp/emacs-lisp/package.el: set variables after info package

From: lin Sun <[email-masked]>
Date: Mon, 17 Apr 2023 15:27:09 +0000

Hi Philip,

> How did you come to the conclusion about the second one?
The 2nd one is necessary because the following lines will use the full
`Info-directory-list` to print its values into the
package-quickstart.el, whose value was modified by the function
`package-activate'.
If I comment out or use the `eval-after-load` on the 2nd one, the
`Info-directory-list` will be empty, and missed in the
package-quickstart.el file.

Hi Ruijie,

> "insure" -> "ensure"?
You're right.
I had fixed my typo in the patch file (only typo in comment), and
attached the new one, please help review again. Thanks
From 91a4bdbccc6f3210f43f46891077c57afd128830 Mon Sep 17 00:00:00 2001
From: Lin Sun <[email-masked]>
Date: Tue, 11 Apr 2023 00:00:13 +0000
Subject: [PATCH] *lisp/emacs-lisp/package.el: better way to load the info
 package

---
 lisp/emacs-lisp/package.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index f92afe56b7..98153a49c7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -892,10 +892,9 @@ package-activate-1
         (add-to-list 'load-path (directory-file-name pkg-dir)))
       ;; Add info node.
       (when (file-exists-p (expand-file-name "dir" pkg-dir))
-        ;; FIXME: not the friendliest, but simple.
-        (require 'info)
-        (info-initialize)
-        (add-to-list 'Info-directory-list pkg-dir))
+        (with-eval-after-load 'info
+          (info-initialize)
+          (add-to-list 'Info-directory-list pkg-dir)))
       (push name package-activated-list)
       ;; Don't return nil.
       t)))
@@ -4427,7 +4426,7 @@ package-quickstart-refresh
   "(Re)Generate the `package-quickstart-file'."
   (interactive)
   (package-initialize 'no-activate)
-  (require 'info)
+  (require 'info) ; ensure Info-directory-list available for package-activate
   (let ((package--quickstart-pkgs ())
         ;; Pretend we haven't activated anything yet!
         (package-activated-list ())
@@ -4472,10 +4471,10 @@ package-quickstart-refresh
           (current-buffer))
       (let ((info-dirs (butlast Info-directory-list)))
         (when info-dirs
-          (pp `(progn (require 'info)
-                      (info-initialize)
-                      (setq Info-directory-list
-                            (append ',info-dirs Info-directory-list)))
+          (pp `(with-eval-after-load 'info
+                 (info-initialize)
+                 (setq Info-directory-list
+                       (append ',info-dirs Info-directory-list)))
               (current-buffer))))
       ;; Use `\s' instead of a space character, so this code chunk is not
       ;; mistaken for an actual file-local section of package.el.
-- 
2.20.5