Mercurial > emacs
comparison 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 |
comparison
equal
deleted
inserted
replaced
108241:731a16c5bb20 | 108242:dc6153a5f4f7 |
---|---|
1824 | 1824 |
1825 ;; This is a hack that allows (setf (eq a 7) B) to mean either | 1825 ;; This is a hack that allows (setf (eq a 7) B) to mean either |
1826 ;; (setq a 7) or (setq a nil) depending on whether B is nil or not. | 1826 ;; (setq a 7) or (setq a nil) depending on whether B is nil or not. |
1827 ;; This is useful when you have control over the PLACE but not over | 1827 ;; This is useful when you have control over the PLACE but not over |
1828 ;; the VALUE, as is the case in define-minor-mode's :variable. | 1828 ;; the VALUE, as is the case in define-minor-mode's :variable. |
1829 (defsetf eq (a b) (v) `(setf ,a (if ,v ,b (not ,b)))) | 1829 (define-setf-method eq (place val) |
1830 (let ((method (get-setf-method place cl-macro-environment)) | |
1831 (val-temp (make-symbol "--eq-val--")) | |
1832 (store-temp (make-symbol "--eq-store--"))) | |
1833 (list (append (nth 0 method) (list val-temp)) | |
1834 (append (nth 1 method) (list val)) | |
1835 (list store-temp) | |
1836 `(let ((,(car (nth 2 method)) | |
1837 (if ,store-temp ,val-temp (not ,val-temp)))) | |
1838 ,(nth 3 method) ,store-temp) | |
1839 `(eq ,(nth 4 method) ,val-temp)))) | |
1830 | 1840 |
1831 ;;; More complex setf-methods. | 1841 ;;; More complex setf-methods. |
1832 ;; These should take &environment arguments, but since full arglists aren't | 1842 ;; These should take &environment arguments, but since full arglists aren't |
1833 ;; available while compiling cl-macs, we fake it by referring to the global | 1843 ;; available while compiling cl-macs, we fake it by referring to the global |
1834 ;; variable cl-macro-environment directly. | 1844 ;; variable cl-macro-environment directly. |