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

From: lin Sun <[email-masked]>
Date: Tue, 11 Apr 2023 05:15:45 +0000

Hi,

The package.el will always require the entire `info.el` on its package
activating function.
Using the `with-eval-after-load` to arrange the work can avoid the
unnecessary loading the `info` package.

Please help review the patch. Thanks.

Best regards
Lin
From 4908999eefa315cfa1a1434baf891ce98ee8d871 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: set variables after info package
 be loaded

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

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index f92afe56b7..bb0491e509 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)))
-- 
2.20.5