branch: elpa/magit
commit e6fef5ceff2b87b9de56ab79b5ea366b5cfede05
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-custom-initialize-after-init: Define near where it is used
The sections for libraries are sorted alphabetically in autoload files
(or randomly, if they are updated instead of being recreated), so to
ensure the autoloaded definition of this function appears before its
autoloaded use, the function and caller have to be defined in the same
library.
Closes #5474.
Closes #5475.
---
lisp/magit-autorevert.el | 18 ++++++++++++++++++
lisp/magit-base.el | 18 ------------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/lisp/magit-autorevert.el b/lisp/magit-autorevert.el
index b5c9ea76cff..100b0dba997 100644
--- a/lisp/magit-autorevert.el
+++ b/lisp/magit-autorevert.el
@@ -104,6 +104,24 @@ seconds of user inactivity. That is not desirable."
;;; Mode
+;;;###autoload
+(progn ; magit-custom-initialize-after-init
+ (defun magit-custom-initialize-after-init (symbol value)
+ (internal--define-uninitialized-variable symbol)
+ (cond ((not after-init-time)
+ (letrec ((f (lambda ()
+ (remove-hook 'after-init-hook f)
+ (custom-initialize-set symbol value))))
+ (add-hook 'after-init-hook f)))
+ ((not load-file-name)
+ (custom-initialize-set symbol value))
+ ((let ((thisfile load-file-name))
+ (letrec ((f (lambda (file)
+ (when (equal file thisfile)
+ (remove-hook 'after-load-functions f)
+ (custom-initialize-set symbol value)))))
+ (add-hook 'after-load-functions f)))))))
+
(defun magit-turn-on-auto-revert-mode-if-desired (&optional file)
(cond (file
(when-let ((buffer (find-buffer-visiting file)))
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index f47efe602e7..99566a83044 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -1026,24 +1026,6 @@ setting `imenu--index-alist' to nil before calling that
function."
;;; Kludges for Custom
-;;;###autoload
-(progn ; magit-custom-initialize-after-init
- (defun magit-custom-initialize-after-init (symbol value)
- (internal--define-uninitialized-variable symbol)
- (cond ((not after-init-time)
- (letrec ((f (lambda ()
- (remove-hook 'after-init-hook f)
- (custom-initialize-set symbol value))))
- (add-hook 'after-init-hook f)))
- ((not load-file-name)
- (custom-initialize-set symbol value))
- ((let ((thisfile load-file-name))
- (letrec ((f (lambda (file)
- (when (equal file thisfile)
- (remove-hook 'after-load-functions f)
- (custom-initialize-set symbol value)))))
- (add-hook 'after-load-functions f)))))))
-
(defun magit-custom-initialize-reset (symbol exp)
"Initialize SYMBOL based on EXP.
Set the value of the variable SYMBOL, using `set-default'