(format-message
"Use keywords rather than deprecated positional arguments to `define-minor-mode'")
exp))))
- keyw keymap-sym tmp)
+ keyw keymap-sym tmp on off)
;; Allow BODY to start with the old INIT-VALUE LIGHTER KEYMAP triplet.
(unless (keywordp (car body))
(setq getter (car variable))
(setq setter `(funcall #',(cdr variable)))))
(:after-hook (setq after-hook (pop body)))
+ (:on (while (and body (not (keywordp (car body))))
+ (push (pop body) on))
+ (setq on (nreverse on)))
+ (:off (while (and body (not (keywordp (car body))))
+ (push (pop body) off))
+ (setq off(nreverse off)))
(_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
(setq pretty-name (easy-mmode-pretty-mode-name mode lighter))
;; TODO? Mark booleans as safe if booleanp? Eg abbrev-mode.
(unless type (setq type '(:type 'boolean)))
+ (when (or on off)
+ (setq body
+ `((if ,mode
+ (progn ,@on)
+ ,@off))))
+
`(progn
;; Define the variable to enable or disable the mode.
,(cond