Mercurial > emacs
diff lisp/emacs-lisp/cl-macs.el @ 108242:dc6153a5f4f7
Use define-minor-mode in more cases.
* term/tvi970.el (tvi970-set-keypad-mode):
* simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
(normal-erase-is-backspace-mode):
* scroll-bar.el (scroll-bar-mode): Use it and define-minor-mode.
(set-scroll-bar-mode-1): (Re)move to its sole caller.
(get-scroll-bar-mode): New function.
* emacs-lisp/cl-macs.el (eq): Handle a non-variable first arg.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 04 May 2010 23:45:21 -0400 |
parents | 731a16c5bb20 |
children | 665253a7d3f6 |
line wrap: on
line diff
--- a/lisp/emacs-lisp/cl-macs.el Tue May 04 22:08:25 2010 -0400 +++ b/lisp/emacs-lisp/cl-macs.el Tue May 04 23:45:21 2010 -0400 @@ -1826,7 +1826,17 @@ ;; (setq a 7) or (setq a nil) depending on whether B is nil or not. ;; This is useful when you have control over the PLACE but not over ;; the VALUE, as is the case in define-minor-mode's :variable. -(defsetf eq (a b) (v) `(setf ,a (if ,v ,b (not ,b)))) +(define-setf-method eq (place val) + (let ((method (get-setf-method place cl-macro-environment)) + (val-temp (make-symbol "--eq-val--")) + (store-temp (make-symbol "--eq-store--"))) + (list (append (nth 0 method) (list val-temp)) + (append (nth 1 method) (list val)) + (list store-temp) + `(let ((,(car (nth 2 method)) + (if ,store-temp ,val-temp (not ,val-temp)))) + ,(nth 3 method) ,store-temp) + `(eq ,(nth 4 method) ,val-temp)))) ;;; More complex setf-methods. ;; These should take &environment arguments, but since full arglists aren't