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) |
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"))) |
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 |
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) |
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 |
|
|