2012-10-09 Stefan Monnier <monnier@iro.umontreal.ca>
+ * bindings.el (mode-line-toggle-read-only, mode-line-toggle-modified)
+ (mode-line-widen, mode-line-input-method-map)
+ (mode-line-coding-system-map, mode-line-remote)
+ (mode-line-unbury-buffer, mode-line-bury-buffer)
+ (mode-line-next-buffer, mode-line-previous-buffer):
+ Replace save-selected-window+select-window => with-selected-window.
+
* progmodes/cc-bytecomp.el (cc-bytecomp-defmacro): Remove, unused.
* progmodes/cc-vars.el (bq-process): Remove, unused.
(defun mode-line-toggle-read-only (event)
"Like `toggle-read-only', for the mode-line."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(read-only-mode 'toggle)))
(defun mode-line-toggle-modified (event)
"Toggle the buffer-modified flag from the mode-line."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(set-buffer-modified-p (not (buffer-modified-p)))
(force-mode-line-update)))
(defun mode-line-widen (event)
"Widen a buffer from the mode-line."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(widen)
(force-mode-line-update)))
(define-key map [mode-line mouse-2]
(lambda (e)
(interactive "e")
- (save-selected-window
- (select-window
- (posn-window (event-start e)))
+ (with-selected-window (posn-window (event-start e))
(toggle-input-method)
(force-mode-line-update))))
(define-key map [mode-line mouse-3]
(lambda (e)
(interactive "e")
- (save-selected-window
- (select-window
- (posn-window (event-start e)))
+ (with-selected-window (posn-window (event-start e))
(describe-current-input-method))))
(purecopy map)))
(define-key map [mode-line mouse-1]
(lambda (e)
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start e)))
+ (with-selected-window (posn-window (event-start e))
(when (and enable-multibyte-characters
buffer-file-coding-system)
(describe-coding-system buffer-file-coding-system)))))
(define-key map [mode-line mouse-3]
(lambda (e)
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start e)))
+ (with-selected-window (posn-window (event-start e))
(call-interactively 'set-buffer-file-coding-system))))
(purecopy map))
"Local keymap for the coding-system part of the mode line.")
'mouse-face 'mode-line-highlight
'help-echo (purecopy (lambda (window _object _point)
(format "%s"
- (save-selected-window
- (select-window window)
+ (with-selected-window window
(concat
(if (file-remote-p default-directory)
"Current directory is remote: "
(defun mode-line-unbury-buffer (event) "\
Call `unbury-buffer' in this window."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(unbury-buffer)))
(defun mode-line-bury-buffer (event) "\
Like `bury-buffer', but temporarily select EVENT's window."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(bury-buffer)))
(defun mode-line-other-buffer () "\
(defun mode-line-next-buffer (event)
"Like `next-buffer', but temporarily select EVENT's window."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(next-buffer)))
(defun mode-line-previous-buffer (event)
"Like `previous-buffer', but temporarily select EVENT's window."
(interactive "e")
- (save-selected-window
- (select-window (posn-window (event-start event)))
+ (with-selected-window (posn-window (event-start event))
(previous-buffer)))
(defmacro bound-and-true-p (var)