/[emacs]/emacs/lisp/emacs-lisp/easy-mmode.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/easy-mmode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.71 by monnier, Wed Aug 24 11:54:25 2005 UTC revision 1.72 by teirllm, Sat Nov 5 23:03:57 2005 UTC
# Line 272  With zero or negative ARG turn mode off. Line 272  With zero or negative ARG turn mode off.
272    "Make GLOBAL-MODE out of the buffer-local minor MODE.    "Make GLOBAL-MODE out of the buffer-local minor MODE.
273  TURN-ON is a function that will be called with no args in every buffer  TURN-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.    and that should try to turn MODE on if applicable for that buffer.
275  KEYS is a list of CL-style keyword arguments:  KEYS is a list of CL-style keyword arguments.  As the minor mode
276  :group to specify the custom group.    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.
283    
284  If MODE's set-up depends on the major mode in effect when it was  If MODE's set-up depends on the major mode in effect when it was
285  enabled, then disabling and reenabling MODE should make MODE work  enabled, then disabling and reenabling MODE should make MODE work
# Line 285  call another major mode in their body." Line 291  call another major mode in their body."
291           (pretty-name (easy-mmode-pretty-mode-name mode))           (pretty-name (easy-mmode-pretty-mode-name mode))
292           (pretty-global-name (easy-mmode-pretty-mode-name global-mode))           (pretty-global-name (easy-mmode-pretty-mode-name global-mode))
293           (group nil)           (group nil)
294           (extra-args nil)           (extra-keywords nil)
295           (MODE-buffers (intern (concat global-mode-name "-buffers")))           (MODE-buffers (intern (concat global-mode-name "-buffers")))
296           (MODE-enable-in-buffers           (MODE-enable-in-buffers
297            (intern (concat global-mode-name "-enable-in-buffers")))            (intern (concat global-mode-name "-enable-in-buffers")))
298           (MODE-check-buffers           (MODE-check-buffers
299            (intern (concat global-mode-name "-check-buffers")))            (intern (concat global-mode-name "-check-buffers")))
300           (MODE-cmhh (intern (concat global-mode-name "-cmhh")))           (MODE-cmhh (intern (concat global-mode-name "-cmhh")))
301           (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode"))))           (MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))
302             keyw)
303    
304      ;; Check keys.      ;; Check keys.
305      (while (keywordp (car keys))      (while (keywordp (setq keyw (car keys)))
306        (case (pop keys)        (setq keys (cdr keys))
307          (:extra-args (setq extra-args (pop keys)))        (case keyw
308          (:group (setq group (nconc group (list :group (pop keys)))))          (:group (setq group (nconc group (list :group (pop keys)))))
309          (t (setq keys (cdr keys)))))          (:global (setq keys (cdr keys)))
310            (t (push keyw extra-keywords) (push (pop keys) extra-keywords))))
311    
312      (unless group      (unless group
313        ;; We might as well provide a best-guess default group.        ;; We might as well provide a best-guess default group.
# Line 317  With prefix ARG, turn %s on if and only Line 325  With prefix ARG, turn %s on if and only
325  %s is actually not turned on in every buffer but only in those  %s is actually not turned on in every buffer but only in those
326  in which `%s' turns it on."  in which `%s' turns it on."
327                    pretty-name pretty-global-name pretty-name turn-on)                    pretty-name pretty-global-name pretty-name turn-on)
328           :global t :extra-args ,extra-args ,@group           :global t ,@group ,@(nreverse extra-keywords)
329    
330           ;; Setup hook to handle future mode changes and new buffers.           ;; Setup hook to handle future mode changes and new buffers.
331           (if ,global-mode           (if ,global-mode

Legend:
Removed from v.1.71  
changed lines
  Added in v.1.72

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26