aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/windows.texi4
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/winner.el34
3 files changed, 27 insertions, 15 deletions
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 4b39e8bfe10..4aeb467dff8 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -538,6 +538,7 @@ Reference Manual}), and cannot exceed the size of the containing frame.
538@vindex winner-dont-bind-my-keys 538@vindex winner-dont-bind-my-keys
539@vindex winner-ring-size 539@vindex winner-ring-size
540@vindex winner-boring-buffers 540@vindex winner-boring-buffers
541@vindex winner-boring-buffers-regexp
541@cindex Winner mode 542@cindex Winner mode
542@cindex mode, Winner 543@cindex mode, Winner
543@cindex undoing window configuration changes 544@cindex undoing window configuration changes
@@ -556,7 +557,8 @@ non-@code{nil} value. By default, Winner mode stores a maximum of 200
556window configurations per frame, but you can change that by modifying 557window configurations per frame, but you can change that by modifying
557the variable @code{winner-ring-size}. If there are some buffers whose 558the variable @code{winner-ring-size}. If there are some buffers whose
558windows you wouldn't want Winner mode to restore, add their names to 559windows you wouldn't want Winner mode to restore, add their names to
559the list variable @code{winner-boring-buffers}. 560the list variable @code{winner-boring-buffers} or to the regexp
561@code{winner-boring-buffers-regexp}.
560 562
561 Follow mode (@kbd{M-x follow-mode}) synchronizes several windows on 563 Follow mode (@kbd{M-x follow-mode}) synchronizes several windows on
562the same buffer so that they always display adjacent sections of that 564the same buffer so that they always display adjacent sections of that
diff --git a/etc/NEWS b/etc/NEWS
index 6b38b81d4ab..988ee8bb41e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -475,6 +475,10 @@ current and the previous or the next line, as before.
475 475
476* Changes in Specialized Modes and Packages in Emacs 27.1 476* Changes in Specialized Modes and Packages in Emacs 27.1
477 477
478+++
479** winner
480*** A new variable, `winner-boring-buffers-regexp', has been added.
481
478** table 482** table
479** `table-generate-source' and friends now support outputting wiki and 483** `table-generate-source' and friends now support outputting wiki and
480mediawiki format tables. 484mediawiki format tables.
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