/[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.41 by monnier, Mon Aug 26 16:40:49 2002 UTC revision 1.42 by monnier, Fri Sep 13 14:16:02 2002 UTC
# Line 90  BODY contains code that will be executed Line 90  BODY contains code that will be executed
90    It will be executed after any toggling but before running the hooks.    It will be executed after any toggling but before running the hooks.
91    BODY can start with a list of CL-style keys specifying additional arguments.    BODY can start with a list of CL-style keys specifying additional arguments.
92    The following keyword arguments are supported:    The following keyword arguments are supported:
93  :group   Followed by the group name to use for any generated `defcustom'.  :group GROUP    Group name to use for any generated `defcustom'.
94  :global  If non-nil specifies that the minor mode is not meant to be  :global GLOBAL  If non-nil specifies that the minor mode is not meant to be
95           buffer-local.  By default, the variable is made buffer-local.                  buffer-local.  By default, the variable is made buffer-local.
96  :init-value  Same as the INIT-VALUE argument.  :init-value VAL Same as the INIT-VALUE argument.
97  :lighter  Same as the LIGHTER argument."  :lighter SPEC   Same as the LIGHTER argument.
98    :require SYM    Same as defcustom's :require argument."
99    ;; Allow skipping the first three args.    ;; Allow skipping the first three args.
100    (cond    (cond
101     ((keywordp init-value)     ((keywordp init-value)
# Line 109  BODY contains code that will be executed Line 110  BODY contains code that will be executed
110           (globalp nil)           (globalp nil)
111           (group nil)           (group nil)
112           (extra-args nil)           (extra-args nil)
113             (require t)
114           (keymap-sym (if (and keymap (symbolp keymap)) keymap           (keymap-sym (if (and keymap (symbolp keymap)) keymap
115                         (intern (concat mode-name "-map"))))                         (intern (concat mode-name "-map"))))
116           (hook (intern (concat mode-name "-hook")))           (hook (intern (concat mode-name "-hook")))
# Line 123  BODY contains code that will be executed Line 125  BODY contains code that will be executed
125          (:global (setq globalp (pop body)))          (:global (setq globalp (pop body)))
126          (:extra-args (setq extra-args (pop body)))          (:extra-args (setq extra-args (pop body)))
127          (:group (setq group (nconc group (list :group (pop body)))))          (:group (setq group (nconc group (list :group (pop body)))))
128            (:require (setq require (pop body)))
129          (t (pop body))))          (t (pop body))))
130    
131      (unless group      (unless group
# Line 159  use either \\[customize] or the function Line 162  use either \\[customize] or the function
162                 :initialize 'custom-initialize-default                 :initialize 'custom-initialize-default
163                 ,@group                 ,@group
164                 :type 'boolean                 :type 'boolean
165                 ,@(when curfile                 ,@(cond
166                     (list                    ((not (and curfile require)) nil)
167                      :require                    ((not (eq require t)) `(:require ,require))
168                      (list 'quote                    (t `(:require
169                            (intern (file-name-nondirectory                         ',(intern (file-name-nondirectory
170                                     (file-name-sans-extension curfile)))))))))                                    (file-name-sans-extension curfile)))))))))
171    
172         ;; The actual function.         ;; The actual function.
173         (defun ,mode (&optional arg ,@extra-args)         (defun ,mode (&optional arg ,@extra-args)
# Line 224  With zero or negative ARG turn mode off. Line 227  With zero or negative ARG turn mode off.
227                                 (symbol-value ',keymap-sym))))                                 (symbol-value ',keymap-sym))))
228                
229         ;; If the mode is global, call the function according to the default.         ;; If the mode is global, call the function according to the default.
230         ,(if globalp         ,(if (and globalp (null init-value))
231              `(if (and load-file-name ,mode)              `(if (and load-file-name ,mode)
232                   (eval-after-load load-file-name '(,mode 1)))))))                   (eval-after-load load-file-name '(,mode 1)))))))
233    

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42

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