comparison lisp/emacs-lisp/easy-mmode.el @ 111222:cdad894f9ed0

Remove duplicate Lisp definitions of define-minor-mode variables defined in C. * lisp/abbrev.el (abbrev-mode): * lisp/composite.el (auto-composition-mode): * lisp/menu-bar.el (menu-bar-mode): * lisp/simple.el (transient-mark-mode): * lisp/tool-bar.el (tool-bar-mode): Adjust the define-minor-mode calls so that they do not define the associated variables twice. * lisp/simple.el (transient-mark-mode): Remove defvar. * lisp/composite.el (auto-composition-mode): Make variable auto-buffer-local. * lisp/cus-start.el: Add transient-mark-mode, menu-bar-mode, tool-bar-mode. Handle multiple groups, and also custom-delayed-init-variables. * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Doc fix. * src/buffer.c (syms_of_buffer) <abbrev-mode, transient-mark-mode>: * src/frame.c (syms_of_frame) <tool-bar-mode>: Move docs here from Lisp.
author Glenn Morris <rgm@gnu.org>
date Thu, 28 Oct 2010 20:29:29 -0700
parents 280c8ae2476d
children 417b1e4d63cd
comparison
equal deleted inserted replaced
111221:e2284aa4cad3 111222:cdad894f9ed0
117 :require SYM Same as in `defcustom'. 117 :require SYM Same as in `defcustom'.
118 :variable PLACE The location (as can be used with `setf') to use instead 118 :variable PLACE The location (as can be used with `setf') to use instead
119 of the variable MODE to store the state of the mode. PLACE 119 of the variable MODE to store the state of the mode. PLACE
120 can also be of the form (GET . SET) where GET is an expression 120 can also be of the form (GET . SET) where GET is an expression
121 that returns the current state and SET is a function that takes 121 that returns the current state and SET is a function that takes
122 a new state and sets it. 122 a new state and sets it. If you specify a :variable, this
123 function assumes it is defined elsewhere.
123 124
124 For example, you could write 125 For example, you could write
125 (define-minor-mode foo-mode \"If enabled, foo on you!\" 126 (define-minor-mode foo-mode \"If enabled, foo on you!\"
126 :lighter \" Foo\" :require 'foo :global t :group 'hassle :version \"27.5\" 127 :lighter \" Foo\" :require 'foo :global t :group 'hassle :version \"27.5\"
127 ...BODY CODE...)" 128 ...BODY CODE...)"
194 ;; We might as well provide a best-guess default group. 195 ;; We might as well provide a best-guess default group.
195 (setq group 196 (setq group
196 `(:group ',(intern (replace-regexp-in-string 197 `(:group ',(intern (replace-regexp-in-string
197 "-mode\\'" "" mode-name))))) 198 "-mode\\'" "" mode-name)))))
198 199
200 ;; TODO? Mark booleans as safe if booleanp? Eg abbrev-mode.
199 (unless type (setq type '(:type 'boolean))) 201 (unless type (setq type '(:type 'boolean)))
200 202
201 `(progn 203 `(progn
202 ;; Define the variable to enable or disable the mode. 204 ;; Define the variable to enable or disable the mode.
203 ,(cond 205 ,(cond
581 (put ',prev-sym 'definition-name ',base)))) 583 (put ',prev-sym 'definition-name ',base))))
582 584
583 585
584 (provide 'easy-mmode) 586 (provide 'easy-mmode)
585 587
586 ;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a
587 ;;; easy-mmode.el ends here 588 ;;; easy-mmode.el ends here