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

From: lin Sun <[email-masked]>
Date: Wed, 19 Apr 2023 05:11:03 +0000

Hi Eli,

I had researched the `info.el', and found the variable
`Info-default-directory-list' is a more proper variable than the
original `Info-directory-list', which is an autoload customer
variable.

Then the patch can be simpler than the previous one, I attached the
new patch, it avoided to require 'info. I verified it on my local.

Please help review the change, thanks !
From 1b93c5469c98254e1c6ab7494272401c5e97ddf5 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: avoid to load the entire info
 package

---
 lisp/emacs-lisp/package.el | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ffa6272dd1..fb26cff463 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -819,7 +819,7 @@ package--autoloads-file-name
    (format "%s-autoloads" (package-desc-name pkg-desc))
    (package-desc-dir pkg-desc)))
 
-(defvar Info-directory-list)
+(defvar Info-default-directory-list)
 (declare-function info-initialize "info" ())
 
 (defvar package--quickstart-pkgs t
@@ -907,10 +907,7 @@ 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))
+        (add-to-list 'Info-default-directory-list pkg-dir))
       (push name package-activated-list)
       ;; Don't return nil.
       t)))
@@ -4458,7 +4455,6 @@ package-quickstart-refresh
   "(Re)Generate the `package-quickstart-file'."
   (interactive)
   (package-initialize 'no-activate)
-  (require 'info)
   (let ((package--quickstart-pkgs ())
         ;; Pretend we haven't activated anything yet!
         (package-activated-list ())
@@ -4468,7 +4464,7 @@ package-quickstart-refresh
         ;; aren't truncated.
         (print-length nil)
         (print-level nil)
-        (Info-directory-list '("")))
+        (Info-default-directory-list '("")))
     (dolist (elt package-alist)
       (condition-case err
           (package-activate (car elt))
@@ -4501,12 +4497,11 @@ package-quickstart-refresh
                   (append ',(mapcar #'package-desc-name package--quickstart-pkgs)
                           package-activated-list)))
           (current-buffer))
-      (let ((info-dirs (butlast Info-directory-list)))
+      (let ((info-dirs (butlast Info-default-directory-list)))
         (when info-dirs
-          (pp `(progn (require 'info)
-                      (info-initialize)
-                      (setq Info-directory-list
-                            (append ',info-dirs Info-directory-list)))
+          (pp `(defvar Info-default-directory-list) (current-buffer))
+          (pp `(setq Info-default-directory-list
+                     (append ',info-dirs Info-default-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