comparison lisp/emacs-lisp/easy-mmode.el @ 112347:67bea318ed68

Merge from emacs-23 branch, up to r100386.
author Glenn Morris <rgm@gnu.org>
date Mon, 17 Jan 2011 18:49:59 -0800
parents 417b1e4d63cd 32f10f475431
children
comparison
equal deleted inserted replaced
112342:c22f11c3d8ba 112347:67bea318ed68
92 92
93 Optional INIT-VALUE is the initial value of the mode's variable. 93 Optional INIT-VALUE is the initial value of the mode's variable.
94 Optional LIGHTER is displayed in the modeline when the mode is on. 94 Optional LIGHTER is displayed in the modeline when the mode is on.
95 Optional KEYMAP is the default keymap bound to the mode keymap. 95 Optional KEYMAP is the default keymap bound to the mode keymap.
96 If non-nil, it should be a variable name (whose value is a keymap), 96 If non-nil, it should be a variable name (whose value is a keymap),
97 a keymap, or a list of arguments for `easy-mmode-define-keymap'. 97 or an expression that returns either a keymap or a list of
98 If KEYMAP is a keymap or list, this also defines the variable MODE-map. 98 arguments for `easy-mmode-define-keymap'. If KEYMAP is not a symbol,
99 this also defines the variable MODE-map.
99 100
100 BODY contains code to execute each time the mode is enabled or disabled. 101 BODY contains code to execute each time the mode is enabled or disabled.
101 It is executed after toggling the mode, and before running MODE-hook. 102 It is executed after toggling the mode, and before running MODE-hook.
102 Before the actual body code, you can write keyword arguments, i.e. 103 Before the actual body code, you can write keyword arguments, i.e.
103 alternating keywords and values. These following special keywords 104 alternating keywords and values. These following special keywords
272 ,(unless (symbolp keymap) ;nil is also a symbol. 273 ,(unless (symbolp keymap) ;nil is also a symbol.
273 `(defvar ,keymap-sym 274 `(defvar ,keymap-sym
274 (let ((m ,keymap)) 275 (let ((m ,keymap))
275 (cond ((keymapp m) m) 276 (cond ((keymapp m) m)
276 ((listp m) (easy-mmode-define-keymap m)) 277 ((listp m) (easy-mmode-define-keymap m))
277 (t (error "Invalid keymap %S" ,keymap)))) 278 (t (error "Invalid keymap %S" m))))
278 ,(format "Keymap for `%s'." mode-name))) 279 ,(format "Keymap for `%s'." mode-name)))
279 280
280 ,(if (not (symbolp mode)) 281 ,(if (not (symbolp mode))
281 (if (or lighter keymap) 282 (if (or lighter keymap)
282 (error ":lighter and :keymap unsupported with mode expression %s" mode)) 283 (error ":lighter and :keymap unsupported with mode expression %s" mode))