Mercurial > emacs
comparison lisp/emacs-lisp/easy-mmode.el @ 64295:f2e16ba201e0
(define-minor-mode): Do not override explicitly specified :initialize keyword.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Thu, 14 Jul 2005 00:56:13 +0000 |
parents | 18a818a2ee7c |
children | 25d7b8b15748 fbb2bea03df9 |
comparison
equal
deleted
inserted
replaced
64294:3ac645ba3986 | 64295:f2e16ba201e0 |
---|---|
140 ((keywordp keymap) (push keymap body) (setq keymap nil))) | 140 ((keywordp keymap) (push keymap body) (setq keymap nil))) |
141 | 141 |
142 (let* ((mode-name (symbol-name mode)) | 142 (let* ((mode-name (symbol-name mode)) |
143 (pretty-name (easy-mmode-pretty-mode-name mode lighter)) | 143 (pretty-name (easy-mmode-pretty-mode-name mode lighter)) |
144 (globalp nil) | 144 (globalp nil) |
145 (initialize nil) | |
145 (group nil) | 146 (group nil) |
146 (extra-args nil) | 147 (extra-args nil) |
147 (extra-keywords nil) | 148 (extra-keywords nil) |
148 (require t) | 149 (require t) |
149 (hook (intern (concat mode-name "-hook"))) | 150 (hook (intern (concat mode-name "-hook"))) |
157 (case keyw | 158 (case keyw |
158 (:init-value (setq init-value (pop body))) | 159 (:init-value (setq init-value (pop body))) |
159 (:lighter (setq lighter (pop body))) | 160 (:lighter (setq lighter (pop body))) |
160 (:global (setq globalp (pop body))) | 161 (:global (setq globalp (pop body))) |
161 (:extra-args (setq extra-args (pop body))) | 162 (:extra-args (setq extra-args (pop body))) |
163 (:initialize (setq initialize (list :initialize (pop body)))) | |
162 (:group (setq group (nconc group (list :group (pop body))))) | 164 (:group (setq group (nconc group (list :group (pop body))))) |
163 (:require (setq require (pop body))) | 165 (:require (setq require (pop body))) |
164 (:keymap (setq keymap (pop body))) | 166 (:keymap (setq keymap (pop body))) |
165 (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) | 167 (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) |
166 | 168 |
167 (setq keymap-sym (if (and keymap (symbolp keymap)) keymap | 169 (setq keymap-sym (if (and keymap (symbolp keymap)) keymap |
168 (intern (concat mode-name "-map")))) | 170 (intern (concat mode-name "-map")))) |
171 | |
172 (unless initialize | |
173 (setq initialize | |
174 '(:initialize 'custom-initialize-default))) | |
169 | 175 |
170 (unless group | 176 (unless group |
171 ;; We might as well provide a best-guess default group. | 177 ;; We might as well provide a best-guess default group. |
172 (setq group | 178 (setq group |
173 `(:group ',(intern (replace-regexp-in-string | 179 `(:group ',(intern (replace-regexp-in-string |
194 See the command `%s' for a description of this minor-mode.")) | 200 See the command `%s' for a description of this minor-mode.")) |
195 | 201 |
196 `(defcustom ,mode ,init-value | 202 `(defcustom ,mode ,init-value |
197 ,(format base-doc-string pretty-name mode mode) | 203 ,(format base-doc-string pretty-name mode mode) |
198 :set 'custom-set-minor-mode | 204 :set 'custom-set-minor-mode |
199 :initialize 'custom-initialize-default | 205 ,@initialize |
200 ,@group | 206 ,@group |
201 :type 'boolean | 207 :type 'boolean |
202 ,@(cond | 208 ,@(cond |
203 ((not (and curfile require)) nil) | 209 ((not (and curfile require)) nil) |
204 ((not (eq require t)) `(:require ,require))) | 210 ((not (eq require t)) `(:require ,require))) |