aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-01-30 20:35:57 -0800
committerGlenn Morris2012-01-30 20:35:57 -0800
commit6c9b47ae84ee5e2f4c7e388d8b1b6fd67daeb61b (patch)
treea78a39c7511eb74f841a180c5164951d75c1ee69
parente4070def538c1ffc40241f3beb79c55a9fbac13e (diff)
downloademacs-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/ChangeLog4
-rw-r--r--lisp/emacs-lisp/easy-mmode.el12
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
102012-01-31 Glenn Morris <rgm@gnu.org> 102012-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
142012-01-30 Glenn Morris <rgm@gnu.org> 162012-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))