summaryrefslogtreecommitdiff
path: root/lisp/frame.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-05-04 22:08:25 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2010-05-04 22:08:25 -0400
commitf44379e7feb79dd734318706abe5a000cff34c9b (patch)
tree79b74dc4cb121d4a3bb18fd9725c33f5b1c030a3 /lisp/frame.el
parent80f00217abd2736464207704bf92eb5a93f84b90 (diff)
downloademacs-f44379e7feb79dd734318706abe5a000cff34c9b.tar.gz
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.
Diffstat (limited to 'lisp/frame.el')
-rw-r--r--lisp/frame.el26
1 files changed, 8 insertions, 18 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index 0628db7ee38..7456db4021c 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -24,6 +24,7 @@
;;; Commentary:
;;; Code:
+(eval-when-compile (require 'cl))
(defvar frame-creation-function-alist
(list (cons nil
@@ -1132,37 +1133,26 @@ To get the frame's current border color, use `frame-parameters'."
(modify-frame-parameters (selected-frame)
(list (cons 'border-color color-name))))
-(defun auto-raise-mode (arg)
+(define-minor-mode auto-raise-mode
"Toggle whether or not the selected frame should auto-raise.
With ARG, turn auto-raise mode on if and only if ARG is positive.
Note that this controls Emacs's own auto-raise feature.
Some window managers allow you to enable auto-raise for certain windows.
You can use that for Emacs windows if you wish, but if you do,
that is beyond the control of Emacs and this command has no effect on it."
- (interactive "P")
- (if (null arg)
- (setq arg
- (if (cdr (assq 'auto-raise (frame-parameters (selected-frame))))
- -1 1)))
- (if (> arg 0)
- (raise-frame (selected-frame)))
- (modify-frame-parameters (selected-frame)
- (list (cons 'auto-raise (> arg 0)))))
+ :variable (frame-parameter nil 'auto-raise)
+ (if (frame-parameter nil 'auto-raise)
+ (raise-frame)))
-(defun auto-lower-mode (arg)
+(define-minor-mode auto-lower-mode
"Toggle whether or not the selected frame should auto-lower.
With ARG, turn auto-lower mode on if and only if ARG is positive.
Note that this controls Emacs's own auto-lower feature.
Some window managers allow you to enable auto-lower for certain windows.
You can use that for Emacs windows if you wish, but if you do,
that is beyond the control of Emacs and this command has no effect on it."
- (interactive "P")
- (if (null arg)
- (setq arg
- (if (cdr (assq 'auto-lower (frame-parameters (selected-frame))))
- -1 1)))
- (modify-frame-parameters (selected-frame)
- (list (cons 'auto-lower (> arg 0)))))
+ :variable (frame-parameter nil 'auto-lower))
+
(defun set-frame-name (name)
"Set the name of the selected frame to NAME.
When called interactively, prompt for the name of the frame.