mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
(define-globalized-minor-mode): Remove left-over code
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Delete the code managing `<MODE>-buffers`, since it's not used any more. Prefer `%S` over `%S` to print arbitrary sexps. (define-minor-mode): Make sure we use the same test to distinguish old-style and new-style.
This commit is contained in:
parent
7291eef004
commit
6eb6cdfbe5
1 changed files with 6 additions and 9 deletions
|
|
@ -248,7 +248,10 @@ INIT-VALUE LIGHTER KEYMAP.
|
||||||
(hook-on (intern (concat mode-name "-on-hook")))
|
(hook-on (intern (concat mode-name "-on-hook")))
|
||||||
(hook-off (intern (concat mode-name "-off-hook")))
|
(hook-off (intern (concat mode-name "-off-hook")))
|
||||||
(interactive t)
|
(interactive t)
|
||||||
(warnwrap (if (or (null body) (keywordp (car body))) #'identity
|
(new-style
|
||||||
|
(or (null body)
|
||||||
|
(keywordp (car body))))
|
||||||
|
(warnwrap (if new-style #'identity
|
||||||
(lambda (exp)
|
(lambda (exp)
|
||||||
(macroexp-warn-and-return
|
(macroexp-warn-and-return
|
||||||
(format-message
|
(format-message
|
||||||
|
|
@ -257,7 +260,7 @@ INIT-VALUE LIGHTER KEYMAP.
|
||||||
keyw keymap-sym tmp)
|
keyw keymap-sym tmp)
|
||||||
|
|
||||||
;; Allow BODY to start with the old INIT-VALUE LIGHTER KEYMAP triplet.
|
;; Allow BODY to start with the old INIT-VALUE LIGHTER KEYMAP triplet.
|
||||||
(unless (keywordp (car body))
|
(unless new-style
|
||||||
(setq init-value (pop body))
|
(setq init-value (pop body))
|
||||||
(unless (keywordp (car body))
|
(unless (keywordp (car body))
|
||||||
(setq lighter (pop body))
|
(setq lighter (pop body))
|
||||||
|
|
@ -493,7 +496,6 @@ on if the hook has explicitly disabled it.
|
||||||
(group nil)
|
(group nil)
|
||||||
(extra-keywords nil)
|
(extra-keywords nil)
|
||||||
(MODE-variable mode)
|
(MODE-variable mode)
|
||||||
(MODE-buffers (intern (concat global-mode-name "-buffers")))
|
|
||||||
(MODE-enable-in-buffer
|
(MODE-enable-in-buffer
|
||||||
(intern (concat global-mode-name "-enable-in-buffer")))
|
(intern (concat global-mode-name "-enable-in-buffer")))
|
||||||
(minor-MODE-hook (intern (concat mode-name "-hook")))
|
(minor-MODE-hook (intern (concat mode-name "-hook")))
|
||||||
|
|
@ -531,7 +533,7 @@ on if the hook has explicitly disabled it.
|
||||||
(define-minor-mode ,global-mode
|
(define-minor-mode ,global-mode
|
||||||
,(concat (format "Toggle %s in many buffers.\n" pretty-name)
|
,(concat (format "Toggle %s in many buffers.\n" pretty-name)
|
||||||
(internal--format-docstring-line
|
(internal--format-docstring-line
|
||||||
"Specifically, %s is enabled in all buffers where `%s' would do it."
|
"Specifically, %s is enabled in all buffers where `%S' would do it."
|
||||||
pretty-name turn-on)
|
pretty-name turn-on)
|
||||||
"\n\n"
|
"\n\n"
|
||||||
(internal--format-docstring-line
|
(internal--format-docstring-line
|
||||||
|
|
@ -613,13 +615,8 @@ list."
|
||||||
;; mode hook which has just been run.
|
;; mode hook which has just been run.
|
||||||
(add-hook ',minor-MODE-hook #',MODE-set-explicitly)
|
(add-hook ',minor-MODE-hook #',MODE-set-explicitly)
|
||||||
|
|
||||||
;; List of buffers left to process.
|
|
||||||
(defvar ,MODE-buffers nil)
|
|
||||||
|
|
||||||
;; The function that calls TURN-ON in the current buffer.
|
;; The function that calls TURN-ON in the current buffer.
|
||||||
(defun ,MODE-enable-in-buffer ()
|
(defun ,MODE-enable-in-buffer ()
|
||||||
;; Remove ourselves from the list of pending buffers.
|
|
||||||
(setq ,MODE-buffers (delq (current-buffer) ,MODE-buffers))
|
|
||||||
(unless ,MODE-set-explicitly
|
(unless ,MODE-set-explicitly
|
||||||
(unless (eq ,MODE-major-mode major-mode)
|
(unless (eq ,MODE-major-mode major-mode)
|
||||||
(if ,MODE-variable
|
(if ,MODE-variable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue