aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2005-11-05 23:03:57 +0000
committerLuc Teirlinck2005-11-05 23:03:57 +0000
commit0ceed14b2e38e1de08823efb6737b9af1ce4268f (patch)
tree9e90a1bd0094bdf19cc362348a3a2034dd8efdec
parent61f570e29072bcf19de85a05d2d9d9de3a17e85e (diff)
downloademacs-0ceed14b2e38e1de08823efb6737b9af1ce4268f.tar.gz
emacs-0ceed14b2e38e1de08823efb6737b9af1ce4268f.zip
(define-global-minor-mode): Pass all specified keyword args on to
`define-minor-mode'. Update docstring.
-rw-r--r--lisp/emacs-lisp/easy-mmode.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index da0ca735efd..710c26e0c6c 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -272,8 +272,14 @@ With zero or negative ARG turn mode off.
272 "Make GLOBAL-MODE out of the buffer-local minor MODE. 272 "Make GLOBAL-MODE out of the buffer-local minor MODE.
273TURN-ON is a function that will be called with no args in every buffer 273TURN-ON is a function that will be called with no args in every buffer
274 and that should try to turn MODE on if applicable for that buffer. 274 and that should try to turn MODE on if applicable for that buffer.
275KEYS is a list of CL-style keyword arguments: 275KEYS is a list of CL-style keyword arguments. As the minor mode
276:group to specify the custom group. 276 defined by this function is always global, any :global keyword is
277 ignored. Other keywords have the same meaning as in `define-minor-mode',
278 which see. In particular, :group specifies the custom group.
279 The most useful keywords are those that are passed on to the
280 `defcustom'. It normally makes no sense to pass the :lighter
281 or :keymap keywords to `define-global-minor-mode', since these
282 are usually passed to the buffer-local version of the minor mode.
277 283
278If MODE's set-up depends on the major mode in effect when it was 284If MODE's set-up depends on the major mode in effect when it was
279enabled, then disabling and reenabling MODE should make MODE work 285enabled, then disabling and reenabling MODE should make MODE work
@@ -285,21 +291,23 @@ call another major mode in their body."
285 (pretty-name (easy-mmode-pretty-mode-name mode)) 291 (pretty-name (easy-mmode-pretty-mode-name mode))
286 (pretty-global-name (easy-mmode-pretty-mode-name global-mode)) 292 (pretty-global-name (easy-mmode-pretty-mode-name global-mode))
287 (group nil) 293 (group nil)
288 (extra-args nil) 294 (extra-keywords nil)
289 (MODE-buffers (intern (concat global-mode-name "-buffers"))) 295 (MODE-buffers (intern (concat global-mode-name "-buffers")))
290 (MODE-enable-in-buffers 296 (MODE-enable-in-buffers
291 (intern (concat global-mode-name "-enable-in-buffers"))) 297 (intern (concat global-mode-name "-enable-in-buffers")))
292 (MODE-check-buffers 298 (MODE-check-buffers
293 (intern (concat global-mode-name "-check-buffers"))) 299 (intern (concat global-mode-name "-check-buffers")))
294 (MODE-cmhh (intern (concat global-mode-name "-cmhh"))) 300 (MODE-cmhh (intern (concat global-mode-name "-cmhh")))
295 (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))) 301 (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))
302 keyw)
296 303
297 ;; Check keys. 304 ;; Check keys.
298 (while (keywordp (car keys)) 305 (while (keywordp (setq keyw (car keys)))
299 (case (pop keys) 306 (setq keys (cdr keys))
300 (:extra-args (setq extra-args (pop keys))) 307 (case keyw
301 (:group (setq group (nconc group (list :group (pop keys))))) 308 (:group (setq group (nconc group (list :group (pop keys)))))
302 (t (setq keys (cdr keys))))) 309 (:global (setq keys (cdr keys)))
310 (t (push keyw extra-keywords) (push (pop keys) extra-keywords))))
303 311
304 (unless group 312 (unless group
305 ;; We might as well provide a best-guess default group. 313 ;; We might as well provide a best-guess default group.
@@ -317,7 +325,7 @@ With prefix ARG, turn %s on if and only if ARG is positive.
317%s is actually not turned on in every buffer but only in those 325%s is actually not turned on in every buffer but only in those
318in which `%s' turns it on." 326in which `%s' turns it on."
319 pretty-name pretty-global-name pretty-name turn-on) 327 pretty-name pretty-global-name pretty-name turn-on)
320 :global t :extra-args ,extra-args ,@group 328 :global t ,@group ,@(nreverse extra-keywords)
321 329
322 ;; Setup hook to handle future mode changes and new buffers. 330 ;; Setup hook to handle future mode changes and new buffers.
323 (if ,global-mode 331 (if ,global-mode