diff options
| author | Glenn Morris | 2012-01-30 20:35:57 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-01-30 20:35:57 -0800 |
| commit | 6c9b47ae84ee5e2f4c7e388d8b1b6fd67daeb61b (patch) | |
| tree | a78a39c7511eb74f841a180c5164951d75c1ee69 | |
| parent | e4070def538c1ffc40241f3beb79c55a9fbac13e (diff) | |
| download | emacs-6c9b47ae84ee5e2f4c7e388d8b1b6fd67daeb61b.tar.gz emacs-6c9b47ae84ee5e2f4c7e388d8b1b6fd67daeb61b.zip | |
Small define-minor-mode fix for variable: keyword.
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
Allow named functions to be used as the cdr of variable:.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e67f90c24b8..865bd7c36fb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -9,7 +9,9 @@ | |||
| 9 | 9 | ||
| 10 | 2012-01-31 Glenn Morris <rgm@gnu.org> | 10 | 2012-01-31 Glenn Morris <rgm@gnu.org> |
| 11 | 11 | ||
| 12 | * emacs-lisp/easy-mmode.el (define-minor-mode): Fix :variable case. | 12 | * emacs-lisp/easy-mmode.el (define-minor-mode): |
| 13 | Fix :variable handling of mode a symbol not equal to modefun. | ||
| 14 | Allow named functions to be used as the cdr of variable:. | ||
| 13 | 15 | ||
| 14 | 2012-01-30 Glenn Morris <rgm@gnu.org> | 16 | 2012-01-30 Glenn Morris <rgm@gnu.org> |
| 15 | 17 | ||
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 7d412f0fcd4..9e1a079df5c 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el | |||
| @@ -160,7 +160,7 @@ For example, you could write | |||
| 160 | (hook (intern (concat mode-name "-hook"))) | 160 | (hook (intern (concat mode-name "-hook"))) |
| 161 | (hook-on (intern (concat mode-name "-on-hook"))) | 161 | (hook-on (intern (concat mode-name "-on-hook"))) |
| 162 | (hook-off (intern (concat mode-name "-off-hook"))) | 162 | (hook-off (intern (concat mode-name "-off-hook"))) |
| 163 | keyw keymap-sym) | 163 | keyw keymap-sym tmp) |
| 164 | 164 | ||
| 165 | ;; Check keys. | 165 | ;; Check keys. |
| 166 | (while (keywordp (setq keyw (car body))) | 166 | (while (keywordp (setq keyw (car body))) |
| @@ -177,7 +177,15 @@ For example, you could write | |||
| 177 | (:require (setq require (pop body))) | 177 | (:require (setq require (pop body))) |
| 178 | (:keymap (setq keymap (pop body))) | 178 | (:keymap (setq keymap (pop body))) |
| 179 | (:variable (setq variable (pop body)) | 179 | (:variable (setq variable (pop body)) |
| 180 | (if (not (functionp (cdr-safe variable))) | 180 | (setq tmp (cdr-safe variable)) |
| 181 | (if (not (or (functionp tmp) | ||
| 182 | (and tmp | ||
| 183 | (symbolp tmp) | ||
| 184 | ;; Hack to allow for named functions not within | ||
| 185 | ;; eval-when-compile. | ||
| 186 | ;; Cf define-compilation-mode. | ||
| 187 | (boundp 'byte-compile-function-environment) | ||
| 188 | (assq tmp byte-compile-function-environment)))) | ||
| 181 | ;; PLACE is not of the form (GET . SET). | 189 | ;; PLACE is not of the form (GET . SET). |
| 182 | (setq mode variable) | 190 | (setq mode variable) |
| 183 | (setq mode (car variable)) | 191 | (setq mode (car variable)) |