emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/git-commit 7cef4cbcda 1/2: magit-add-section-hook: Autoloa


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 7cef4cbcda 1/2: magit-add-section-hook: Autoload
Date: Wed, 24 Jul 2024 10:00:02 -0400 (EDT)

branch: elpa/git-commit
commit 7cef4cbcdaa9b3231d1e44bb8c0619d6194508af
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-add-section-hook: Autoload
    
    This makes it possible to use
    
      (use-package magit
        :defer t
        :config (magit-add-section-hook ...))
    
    which essentially expands to
    
      (with-eval-after-load 'magit
        (magit-add-section-hook ...))
    
    without getting a warning about `magit-add-section-hook'
    possibly not being defined at runtime.
    
    In the absence of an official autoload, users had to use
    
      (use-package magit
        :defer t
        :functions (magit-add-section-hook)
        :config (magit-add-section-hook ...))
    
    but that's confusing because `:functions' only has an effect when
    *compiling* a file.  When using `pp-macroexpand-last-sexp', then
    we are not compiling, so there is no need to silence the compiler
    by using `declare-function', and `use-package' optimizes it away,
    confusing anyone who hopes macro-expansion reveals the whole truth,
    but for that, one also has to read `use-package-normalize-keywords'.
---
 lisp/magit-section.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 26c94f1592..7642aaa82f 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -2149,6 +2149,7 @@ If optional SECTION is nil, use the current section."
 FUNCTION has to move point forward or return nil."
   (while (and (not (eobp)) (funcall function))))
 
+;;;###autoload
 (defun magit-add-section-hook (hook function &optional at append local)
   "Add to the value of section hook HOOK the function FUNCTION.
 



reply via email to

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