bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Philip Kaludercic
Subject: bug#62767: 29.0.90; [PATCH] *lisp/emacs-lisp/package.el: set variables after info package
Date: Mon, 17 Apr 2023 13:24:56 +0000

lin Sun <sunlin7@yahoo.com> writes:

> Hi Philip,
>
> I had researched these three calls with the "require 'info", and
> updated the patch for better performance.
> The 1 th and 3rd can be rewritten with the new form, 

OK, then we still have to find out if these changes are safe.  As
mentioned before, I hesitate in using `with-eval-after-load', probably
because of the complicated history of `eval-after-load'.  I suppose that
Stefan might know more (as it is due to him that I am careful here), so
I have added him to the thread.

>                                                      but the 2nd one
> is necessary, and should not be changed.

How did you come to the conclusion about the second one?

> Please help review the new attached patch file. Thanks.
>
> Hi Eli,
>> And this is the only place in Emacs where we have (require 'FOO) and
>> FOO is not necessary for Emacs to start up?
> My configuration will load the package.el at startup, so I tracked the
> initial packages, and found the "require `info" will take ~1 seconds
> on my old PC.
> I didn't pay attention to other packages, if I found a heavy one, I'll
> post it on the mail list.
>
> From 91a4bdbccc6f3210f43f46891077c57afd128830 Mon Sep 17 00:00:00 2001
> From: Lin Sun <sunlin7@hotmail.com>
> 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) ; insure Info-directory-list avaliable 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]