diff lisp/emacs-lisp/cl-macs.el @ 108241:731a16c5bb20

Use define-minor-mode for less obvious cases. * emacs-lisp/easy-mmode.el (define-minor-mode): Add :variable keyword. * emacs-lisp/cl-macs.el (terminal-parameter, eq): Add setf method. * international/iso-ascii.el (iso-ascii-mode): * frame.el (auto-raise-mode, auto-lower-mode): * composite.el (global-auto-composition-mode): Use define-minor-mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 04 May 2010 22:08:25 -0400
parents 0a321c28c1b4
children dc6153a5f4f7
line wrap: on
line diff
--- a/lisp/emacs-lisp/cl-macs.el	Tue May 04 20:21:32 2010 +0200
+++ b/lisp/emacs-lisp/cl-macs.el	Tue May 04 22:08:25 2010 -0400
@@ -1769,6 +1769,7 @@
 (defsetf frame-visible-p cl-set-frame-visible-p)
 (defsetf frame-width set-screen-width t)
 (defsetf frame-parameter set-frame-parameter t)
+(defsetf terminal-parameter set-terminal-parameter)
 (defsetf getenv setenv t)
 (defsetf get-register set-register)
 (defsetf global-key-binding global-set-key)
@@ -1821,10 +1822,16 @@
 (defsetf x-get-secondary-selection x-own-secondary-selection t)
 (defsetf x-get-selection x-own-selection t)
 
+;; This is a hack that allows (setf (eq a 7) B) to mean either
+;; (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))))
+
 ;;; More complex setf-methods.
-;;; These should take &environment arguments, but since full arglists aren't
-;;; available while compiling cl-macs, we fake it by referring to the global
-;;; variable cl-macro-environment directly.
+;; These should take &environment arguments, but since full arglists aren't
+;; available while compiling cl-macs, we fake it by referring to the global
+;; variable cl-macro-environment directly.
 
 (define-setf-method apply (func arg1 &rest rest)
   (or (and (memq (car-safe func) '(quote function function*))