aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/easy-mmode.el
diff options
context:
space:
mode:
authorAlan Mackenzie <[email protected]>2012-02-23 18:51:22 +0000
committerAlan Mackenzie <[email protected]>2012-02-23 18:51:22 +0000
commit2cb228f753fbaea3a86dfc1fd57b61db13624a2d (patch)
treef9f55e68442986ba10b4a25129855beec6b450d2 /lisp/emacs-lisp/easy-mmode.el
parentb2e4ca7d12b306cd15d4ec24ce7749db56729e2b (diff)
Add new parameter :after-hook to define-minor-mode. Use this in the
definition of font-lock-mode.
Diffstat (limited to 'lisp/emacs-lisp/easy-mmode.el')
-rw-r--r--lisp/emacs-lisp/easy-mmode.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index dbacba6cd2..88698a1f06 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -135,6 +135,8 @@ BODY contains code to execute each time the mode is enabled or disabled.
the new state, and sets it. If you specify a :variable,
this function does not define a MODE variable (nor any of
the terms used in :variable).
+:after-hook A single lisp form which is evaluated after the mode hooks
+ have been run. It should not be quoted.
For example, you could write
(define-minor-mode foo-mode \"If enabled, foo on you!\"
@@ -170,6 +172,7 @@ For example, you could write
(setter nil) ;The function (if any) to set the mode var.
(modefun mode) ;The minor mode function name we're defining.
(require t)
+ (after-hook nil)
(hook (intern (concat mode-name "-hook")))
(hook-on (intern (concat mode-name "-on-hook")))
(hook-off (intern (concat mode-name "-off-hook")))
@@ -197,6 +200,7 @@ For example, you could write
(setq mode variable)
(setq mode (car variable))
(setq setter (cdr variable))))
+ (:after-hook (setq after-hook (pop body)))
(t (push keyw extra-keywords) (push (pop body) extra-keywords))))
(setq keymap-sym (if (and keymap (symbolp keymap)) keymap
@@ -275,7 +279,8 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
(not (equal ,last-message
(current-message))))
(message ,(format "%s %%sabled" pretty-name)
- (if ,mode "en" "dis"))))))
+ (if ,mode "en" "dis")))))
+ ,@(when after-hook `(,after-hook)))
(force-mode-line-update)
;; Return the new setting.
,mode)