diff options
| author | Luc Teirlinck | 2005-07-16 02:25:48 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2005-07-16 02:25:48 +0000 |
| commit | fceb44d2863736de37b3986fe03a9381190be0a4 (patch) | |
| tree | 9bde020821ce7ddfb2e48acc7ef189259da1c44e /lisp | |
| parent | 9f8a6f72056a56d8d5ed248a596c20664e1a6716 (diff) | |
| download | emacs-fceb44d2863736de37b3986fe03a9381190be0a4.tar.gz emacs-fceb44d2863736de37b3986fe03a9381190be0a4.zip | |
(define-minor-mode): Avoid constructing a defcustom with two :set or
:type keywords.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 3b4662277b6..87f3e7249aa 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -142,8 +142,10 @@ For example, you could write | |||
| 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 | (set nil) | ||
| 145 | (initialize nil) | 146 | (initialize nil) |
| 146 | (group nil) | 147 | (group nil) |
| 148 | (type nil) | ||
| 147 | (extra-args nil) | 149 | (extra-args nil) |
| 148 | (extra-keywords nil) | 150 | (extra-keywords nil) |
| 149 | (require t) | 151 | (require t) |
| @@ -160,8 +162,10 @@ For example, you could write | |||
| 160 | (:lighter (setq lighter (pop body))) | 162 | (:lighter (setq lighter (pop body))) |
| 161 | (:global (setq globalp (pop body))) | 163 | (:global (setq globalp (pop body))) |
| 162 | (:extra-args (setq extra-args (pop body))) | 164 | (:extra-args (setq extra-args (pop body))) |
| 165 | (:set (setq set (list :set (pop body)))) | ||
| 163 | (:initialize (setq initialize (list :initialize (pop body)))) | 166 | (:initialize (setq initialize (list :initialize (pop body)))) |
| 164 | (:group (setq group (nconc group (list :group (pop body))))) | 167 | (:group (setq group (nconc group (list :group (pop body))))) |
| 168 | (:type (setq type (list :type (pop body)))) | ||
| 165 | (:require (setq require (pop body))) | 169 | (:require (setq require (pop body))) |
| 166 | (:keymap (setq keymap (pop body))) | 170 | (:keymap (setq keymap (pop body))) |
| 167 | (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) | 171 | (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) |
| @@ -169,9 +173,10 @@ For example, you could write | |||
| 169 | (setq keymap-sym (if (and keymap (symbolp keymap)) keymap | 173 | (setq keymap-sym (if (and keymap (symbolp keymap)) keymap |
| 170 | (intern (concat mode-name "-map")))) | 174 | (intern (concat mode-name "-map")))) |
| 171 | 175 | ||
| 176 | (unless set (setq set '(:set 'custom-set-minor-mode))) | ||
| 177 | |||
| 172 | (unless initialize | 178 | (unless initialize |
| 173 | (setq initialize | 179 | (setq initialize '(:initialize 'custom-initialize-default))) |
| 174 | '(:initialize 'custom-initialize-default))) | ||
| 175 | 180 | ||
| 176 | (unless group | 181 | (unless group |
| 177 | ;; We might as well provide a best-guess default group. | 182 | ;; We might as well provide a best-guess default group. |
| @@ -179,6 +184,8 @@ For example, you could write | |||
| 179 | `(:group ',(intern (replace-regexp-in-string | 184 | `(:group ',(intern (replace-regexp-in-string |
| 180 | "-mode\\'" "" mode-name))))) | 185 | "-mode\\'" "" mode-name))))) |
| 181 | 186 | ||
| 187 | (unless type (setq type '(:type 'boolean))) | ||
| 188 | |||
| 182 | `(progn | 189 | `(progn |
| 183 | ;; Define the variable to enable or disable the mode. | 190 | ;; Define the variable to enable or disable the mode. |
| 184 | ,(if (not globalp) | 191 | ,(if (not globalp) |
| @@ -201,10 +208,10 @@ See the command `%s' for a description of this minor-mode.")) | |||
| 201 | 208 | ||
| 202 | `(defcustom ,mode ,init-value | 209 | `(defcustom ,mode ,init-value |
| 203 | ,(format base-doc-string pretty-name mode mode) | 210 | ,(format base-doc-string pretty-name mode mode) |
| 204 | :set 'custom-set-minor-mode | 211 | ,@set |
| 205 | ,@initialize | 212 | ,@initialize |
| 206 | ,@group | 213 | ,@group |
| 207 | :type 'boolean | 214 | ,@type |
| 208 | ,@(cond | 215 | ,@(cond |
| 209 | ((not (and curfile require)) nil) | 216 | ((not (and curfile require)) nil) |
| 210 | ((not (eq require t)) `(:require ,require))) | 217 | ((not (eq require t)) `(:require ,require))) |