mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
(custom-initialize-after-file): New function
Some global minor modes require initialization. Those that are preloaded currently abuse `custom-initialize-delay` for that, but it's suboptimal and doesn't help those that aren't preloaded. So introduce a new function to fill that need. While at it, make `define-globalized-minor-mode` use it automatically when useful. * lisp/custom.el (custom-initialize-after-file-load): New function. * lisp/tooltip.el (tooltip-mode): * lisp/paren.el (show-paren-mode): * lisp/rfn-eshadow.el (file-name-shadow-mode): * lisp/epa-hook.el (auto-encryption-mode): * lisp/minibuffer.el (minibuffer-regexp-mode, minibuffer-nonselected-mode): * lisp/electric.el (electric-indent-mode): Use it instead of `custom-initialize-delay` since the value does not depend on the runtime context. (electric-quote-mode): Don't use `custom-initialize-delay` since the default value is nil anyway. * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Automatically add `:initialize` if needed. * lisp/emacs-lisp/eldoc.el (global-eldoc-mode): Remove `:initialize`, now provided automatically. * doc/lispref/customize.texi (Variable Definitions): * doc/lispref/modes.texi (Defining Minor Modes): Document and Suggest `custom-initialize-after-file-load` instead of `custom-initialize-delay`.
This commit is contained in:
parent
100963b492
commit
287fb2fbad
13 changed files with 69 additions and 40 deletions
|
|
@ -522,6 +522,12 @@ on if the hook has explicitly disabled it.
|
|||
(when (easy-mmode--globalized-predicate-p ,MODE-predicate)
|
||||
(funcall ,turn-on-function)))))
|
||||
(_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
|
||||
(setq extra-keywords (nreverse extra-keywords))
|
||||
|
||||
(when (and (plist-get extra-keywords :init-value)
|
||||
(null (plist-get extra-keywords :initialize)))
|
||||
(setq extra-keywords `(:initialize #'custom-initialize-after-file-load
|
||||
. ,extra-keywords)))
|
||||
|
||||
`(progn
|
||||
(progn
|
||||
|
|
@ -553,7 +559,7 @@ Disable the mode if ARG is a negative number.\n\n"
|
|||
"`%s' is used to control which modes this minor mode is used in."
|
||||
MODE-predicate))
|
||||
""))
|
||||
:global t ,@group ,@(nreverse extra-keywords)
|
||||
:global t ,@group ,@extra-keywords
|
||||
|
||||
;; Setup hook to handle future mode changes and new buffers.
|
||||
(if ,global-mode
|
||||
|
|
|
|||
|
|
@ -238,7 +238,6 @@ expression point is on." :lighter eldoc-minor-mode-string
|
|||
|
||||
;;;###autoload
|
||||
(define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode
|
||||
:initialize 'custom-initialize-delay
|
||||
:init-value t
|
||||
;; For `read--expression', the usual global mode mechanism of
|
||||
;; `change-major-mode-hook' runs in the minibuffer before
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue