emacs-devel
[Top][All Lists]
Advanced

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

Re: [nongnu] elpa/git-commit 8b5d0b2bc6 1/2: Don’t try to evaluate start


From: Stefan Monnier
Subject: Re: [nongnu] elpa/git-commit 8b5d0b2bc6 1/2: Don’t try to evaluate startup assertions when byte-compiling
Date: Fri, 18 Mar 2022 15:33:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> --- a/lisp/magit.el
> +++ b/lisp/magit.el
> @@ -616,7 +616,7 @@ and Emacs to it."
>       ;; See comment above.
>       "https://github.com/magit/magit/wiki/Don't-set-$GIT_DIR-and-alike"))
>    ;; Git isn't required while building Magit.
> -  (cl-eval-when (load eval)
> +  (unless byte-compile-current-file
>      (magit-git-version-assert))
>    (when (version< emacs-version magit--minimal-emacs)
>      (display-warning 'magit (format "\
> @@ -672,10 +672,11 @@ For X11 something like ~/.xinitrc should work.\n"
>  (with-eval-after-load 'bookmark
>    (require 'magit-bookmark))
>  
> -(if after-init-time
> -    (progn (magit-startup-asserts)
> -           (magit-version))
> -  (add-hook 'after-init-hook #'magit-startup-asserts t)
> -  (add-hook 'after-init-hook #'magit-version t))
> +(unless byte-compile-current-file
> +  (if after-init-time
> +      (progn (magit-startup-asserts)
> +             (magit-version))
> +    (add-hook 'after-init-hook #'magit-startup-asserts t)
> +    (add-hook 'after-init-hook #'magit-version t)))
>  
>  ;;; magit.el ends here

BTW, the better way to do that is to move the checking code to
a function and call that function the first time Magit is used, rather
than run it when loading some file.


        Stefan "loading a file should not have such side-effects"




reply via email to

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