Mercurial > emacs
comparison lisp/emacs-lisp/easy-mmode.el @ 48838:e0689be193e2
(define-minor-mode): Use `custom-current-group'.
Pass all groups to the hook.
(easy-mmode-define-global-mode): Use `custom-current-group'.
author | Markus Rost <rost@math.uni-bielefeld.de> |
---|---|
date | Fri, 13 Dec 2002 23:54:45 +0000 |
parents | 1174e4c84d58 |
children | 0d8b17d428b5 |
comparison
equal
deleted
inserted
replaced
48837:15dcdff64493 | 48838:e0689be193e2 |
---|---|
138 (t (pop body)))) | 138 (t (pop body)))) |
139 | 139 |
140 (unless group | 140 (unless group |
141 ;; We might as well provide a best-guess default group. | 141 ;; We might as well provide a best-guess default group. |
142 (setq group | 142 (setq group |
143 `(:group ',(intern (replace-regexp-in-string "-mode\\'" "" | 143 `(:group ',(or (custom-current-group) |
144 mode-name))))) | 144 (intern (replace-regexp-in-string |
145 "-mode\\'" "" mode-name)))))) | |
145 | 146 |
146 `(progn | 147 `(progn |
147 ;; Define the variable to enable or disable the mode. | 148 ;; Define the variable to enable or disable the mode. |
148 ,(if (not globalp) | 149 ,(if (not globalp) |
149 `(progn | 150 `(progn |
209 :autoload-end | 210 :autoload-end |
210 | 211 |
211 ;; The toggle's hook. | 212 ;; The toggle's hook. |
212 (defcustom ,hook nil | 213 (defcustom ,hook nil |
213 ,(format "Hook run at the end of function `%s'." mode-name) | 214 ,(format "Hook run at the end of function `%s'." mode-name) |
214 :group ,(cadr group) | 215 ,@group |
215 :type 'hook) | 216 :type 'hook) |
216 | 217 |
217 ;; Define the minor-mode keymap. | 218 ;; Define the minor-mode keymap. |
218 ,(unless (symbolp keymap) ;nil is also a symbol. | 219 ,(unless (symbolp keymap) ;nil is also a symbol. |
219 `(defvar ,keymap-sym | 220 `(defvar ,keymap-sym |
261 (t (setq keys (cdr keys))))) | 262 (t (setq keys (cdr keys))))) |
262 | 263 |
263 (unless group | 264 (unless group |
264 ;; We might as well provide a best-guess default group. | 265 ;; We might as well provide a best-guess default group. |
265 (setq group | 266 (setq group |
266 `(:group ',(intern (replace-regexp-in-string "-mode\\'" "" | 267 `(:group ',(or (custom-current-group) |
267 (symbol-name mode)))))) | 268 (intern (replace-regexp-in-string |
269 "-mode\\'" "" (symbol-name mode))))))) | |
270 | |
268 `(progn | 271 `(progn |
269 ;; The actual global minor-mode | 272 ;; The actual global minor-mode |
270 (define-minor-mode ,global-mode | 273 (define-minor-mode ,global-mode |
271 ,(format "Toggle %s in every buffer. | 274 ,(format "Toggle %s in every buffer. |
272 With prefix ARG, turn %s on if and only if ARG is positive. | 275 With prefix ARG, turn %s on if and only if ARG is positive. |