emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master f9744d2 1/5: Add a new regexp variable to control b


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master f9744d2 1/5: Add a new regexp variable to control boring winner buffers
Date: Thu, 27 Jun 2019 15:00:46 -0400 (EDT)

branch: master
commit f9744d23e5bdc90ebdfaf78db55966e436876b28
Author: Thierry Volpiatto <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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).
---
 doc/emacs/windows.texi |  4 +++-
 etc/NEWS               |  4 ++++
 lisp/winner.el         | 34 ++++++++++++++++++++--------------
 3 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 4b39e8b..4aeb467 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.
 @vindex winner-dont-bind-my-keys
 @vindex winner-ring-size
 @vindex winner-boring-buffers
+@vindex winner-boring-buffers-regexp
 @cindex Winner mode
 @cindex mode, Winner
 @cindex undoing window configuration changes
@@ -556,7 +557,8 @@ non-@code{nil} value.  By default, Winner mode stores a 
maximum of 200
 window configurations per frame, but you can change that by modifying
 the variable @code{winner-ring-size}.  If there are some buffers whose
 windows you wouldn't want Winner mode to restore, add their names to
-the list variable @code{winner-boring-buffers}.
+the list variable @code{winner-boring-buffers} or to the regexp
+@code{winner-boring-buffers-regexp}.
 
   Follow mode (@kbd{M-x follow-mode}) synchronizes several windows on
 the same buffer so that they always display adjacent sections of that
diff --git a/etc/NEWS b/etc/NEWS
index 6b38b81..988ee8b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -475,6 +475,10 @@ current and the previous or the next line, as before.
 
 * Changes in Specialized Modes and Packages in Emacs 27.1
 
++++
+** winner
+*** A new variable, `winner-boring-buffers-regexp', has been added.
+
 ** table
 ** `table-generate-source' and friends now support outputting wiki and
 mediawiki format tables.
diff --git a/lisp/winner.el b/lisp/winner.el
index 92dd9c0..ec3b296 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -57,21 +57,22 @@
 
 (defcustom winner-dont-bind-my-keys nil
   "Non-nil means do not bind keys in Winner mode."
-  :type  'boolean
-  :group 'winner)
+  :type 'boolean)
 
 (defcustom winner-ring-size 200
   "Maximum number of stored window configurations per frame."
-  :type  'integer
-  :group 'winner)
+  :type 'integer)
 
 (defcustom winner-boring-buffers '("*Completions*")
   "List of buffer names whose windows `winner-undo' will not restore.
 You may want to include buffer names such as *Help*, *Apropos*,
 *Buffer List*, *info* and *Compile-Log*."
-  :type '(repeat string)
-  :group 'winner)
+  :type '(repeat string))
 
+(defcustom winner-boring-buffers-regexp nil
+  "`winner-undo' will not restore windows with buffers matching this regexp."
+  :type 'string
+  :version "27.1")
 
 
 ;;;; Saving old configurations (internal variables and subroutines)
@@ -273,8 +274,9 @@ You may want to include buffer names such as *Help*, 
*Apropos*,
 
 ;; Make sure point does not end up in the minibuffer and delete
 ;; windows displaying dead or boring buffers
-;; (c.f. `winner-boring-buffers').  Return nil if all the windows
-;; should be deleted.  Preserve correct points and marks.
+;; (c.f. `winner-boring-buffers') and `winner-boring-buffers-regexp'.
+;; Return nil if all the windows should be deleted.  Preserve correct
+;; points and marks.
 (defun winner-set (conf)
   ;; For the format of `conf', see `winner-conf'.
   (let* ((buffers nil)
@@ -302,8 +304,12 @@ You may want to include buffer names such as *Help*, 
*Apropos*,
                                     (not (= marker pos)))
                            (setq pos marker))
                          (setf (window-point win) pos)))
-                     (not (member (buffer-name (window-buffer win))
-                                  winner-boring-buffers)))
+                    (not (or (member (buffer-name (window-buffer win))
+                                     winner-boring-buffers)
+                             (and winner-boring-buffers-regexp
+                                  (string-match
+                                   winner-boring-buffers-regexp
+                                   (buffer-name (window-buffer win)))))))
           (push win xwins)))            ; delete this window
 
       ;; Restore marks
@@ -320,10 +326,10 @@ You may want to include buffer names such as *Help*, 
*Apropos*,
       ;; Return t if this is still a possible configuration.
       (or (null xwins)
          (progn
-            (mapc 'delete-window (cdr xwins)) ; delete all but one
-            (unless (one-window-p t)
-              (delete-window (car xwins))
-              t))))))
+           (mapc 'delete-window (cdr xwins)) ; delete all but one
+           (unless (one-window-p t)
+             (delete-window (car xwins))
+             t))))))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]