aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorThierry Volpiatto2019-06-27 19:20:50 +0200
committerLars Ingebrigtsen2019-06-27 21:00:35 +0200
commitf9744d23e5bdc90ebdfaf78db55966e436876b28 (patch)
treeb824342ae0c5c42b9dd6fc168df3bf446b271d9e /lisp
parente51f328465759b8da9031c6fc30d3fd14f1a0c38 (diff)
downloademacs-f9744d23e5bdc90ebdfaf78db55966e436876b28.tar.gz
emacs-f9744d23e5bdc90ebdfaf78db55966e436876b28.zip
Add a new regexp variable to control boring winner buffers
* doc/emacs/windows.texi (Window Convenience): Mention it. * lisp/winner.el (winner-boring-buffers-regexp): New variable. * lisp/winner.el (winner-set): Use it (bug#11151).
Diffstat (limited to 'lisp')
-rw-r--r--lisp/winner.el34
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/winner.el b/lisp/winner.el
index 92dd9c0f122..ec3b296489c 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -57,21 +57,22 @@
57 57
58(defcustom winner-dont-bind-my-keys nil 58(defcustom winner-dont-bind-my-keys nil
59 "Non-nil means do not bind keys in Winner mode." 59 "Non-nil means do not bind keys in Winner mode."
60 :type 'boolean 60 :type 'boolean)
61 :group 'winner)
62 61
63(defcustom winner-ring-size 200 62(defcustom winner-ring-size 200
64 "Maximum number of stored window configurations per frame." 63 "Maximum number of stored window configurations per frame."
65 :type 'integer 64 :type 'integer)
66 :group 'winner)
67 65
68(defcustom winner-boring-buffers '("*Completions*") 66(defcustom winner-boring-buffers '("*Completions*")
69 "List of buffer names whose windows `winner-undo' will not restore. 67 "List of buffer names whose windows `winner-undo' will not restore.
70You may want to include buffer names such as *Help*, *Apropos*, 68You may want to include buffer names such as *Help*, *Apropos*,
71*Buffer List*, *info* and *Compile-Log*." 69*Buffer List*, *info* and *Compile-Log*."
72 :type '(repeat string) 70 :type '(repeat string))
73 :group 'winner)
74 71
72(defcustom winner-boring-buffers-regexp nil
73 "`winner-undo' will not restore windows with buffers matching this regexp."
74 :type 'string
75 :version "27.1")
75 76
76 77
77;;;; Saving old configurations (internal variables and subroutines) 78;;;; Saving old configurations (internal variables and subroutines)
@@ -273,8 +274,9 @@ You may want to include buffer names such as *Help*, *Apropos*,
273 274
274;; Make sure point does not end up in the minibuffer and delete 275;; Make sure point does not end up in the minibuffer and delete
275;; windows displaying dead or boring buffers 276;; windows displaying dead or boring buffers
276;; (c.f. `winner-boring-buffers'). Return nil if all the windows 277;; (c.f. `winner-boring-buffers') and `winner-boring-buffers-regexp'.
277;; should be deleted. Preserve correct points and marks. 278;; Return nil if all the windows should be deleted. Preserve correct
279;; points and marks.
278(defun winner-set (conf) 280(defun winner-set (conf)
279 ;; For the format of `conf', see `winner-conf'. 281 ;; For the format of `conf', see `winner-conf'.
280 (let* ((buffers nil) 282 (let* ((buffers nil)
@@ -302,8 +304,12 @@ You may want to include buffer names such as *Help*, *Apropos*,
302 (not (= marker pos))) 304 (not (= marker pos)))
303 (setq pos marker)) 305 (setq pos marker))
304 (setf (window-point win) pos))) 306 (setf (window-point win) pos)))
305 (not (member (buffer-name (window-buffer win)) 307 (not (or (member (buffer-name (window-buffer win))
306 winner-boring-buffers))) 308 winner-boring-buffers)
309 (and winner-boring-buffers-regexp
310 (string-match
311 winner-boring-buffers-regexp
312 (buffer-name (window-buffer win)))))))
307 (push win xwins))) ; delete this window 313 (push win xwins))) ; delete this window
308 314
309 ;; Restore marks 315 ;; Restore marks
@@ -320,10 +326,10 @@ You may want to include buffer names such as *Help*, *Apropos*,
320 ;; Return t if this is still a possible configuration. 326 ;; Return t if this is still a possible configuration.
321 (or (null xwins) 327 (or (null xwins)
322 (progn 328 (progn
323 (mapc 'delete-window (cdr xwins)) ; delete all but one 329 (mapc 'delete-window (cdr xwins)) ; delete all but one
324 (unless (one-window-p t) 330 (unless (one-window-p t)
325 (delete-window (car xwins)) 331 (delete-window (car xwins))
326 t)))))) 332 t))))))
327 333
328 334
329 335