unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#37514: PATCH: Add setting to allow switching to an already-visible buffer by default
@ 2019-09-25 21:24 Jefferson Carpenter
  2019-09-26  7:12 ` Eli Zaretskii
  2019-09-26  7:20 ` martin rudalics
  0 siblings, 2 replies; 28+ messages in thread
From: Jefferson Carpenter @ 2019-09-25 21:24 UTC (permalink / raw)
  To: 37514


[-- Attachment #1.1: Type: text/plain, Size: 634 bytes --]

A not-uncommon workflow of mine is to have more than one window looking at the same buffer in several different places.  Often in one of these windows I switch to some other buffer (perhaps a shell) and then want to switch directly back to the same place I was just looking at in main buffer.  However since my main buffer is already visible in another window, C-x b (switch-to-buffer) does not default to that buffer, but prefers a buffer that is not already visible.  This customization setting allows users to override that behavior so that switch-to-buffer does not prefer buffers that are not already visible.



Jefferson

[-- Attachment #1.2: Type: text/html, Size: 2399 bytes --]

[-- Attachment #2: 0001-Add-setting-to-allow-switching-to-an-already-visible.patch --]
[-- Type: application/octet-stream, Size: 1613 bytes --]

From 65ad2d664f6667200d7edadaba3a9acdec60c7ff Mon Sep 17 00:00:00 2001
From: Jefferson Carpenter <jefferson.carpenter@transunion.com>
Date: Wed, 25 Sep 2019 16:03:49 -0500
Subject: [PATCH] Add setting to allow switching to an already-visible buffer
 by default

---
 lisp/window.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/window.el b/lisp/window.el
index 620eacdd29..13009ee5ee 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8158,6 +8158,13 @@ currently selected window; otherwise it will be displayed in
 another window."
   (pop-to-buffer buffer display-buffer--same-window-action norecord))
 
+(defcustom switch-to-buffer-visible-ok nil
+  "If non-nil, switch-to-buffer interactive prompt does not
+  prefer non-visible buffers."
+  :type 'boolean
+  :initialize 'custom-initialize-default
+  :group 'windows)
+
 (defun read-buffer-to-switch (prompt)
   "Read the name of a buffer to switch to, prompting with PROMPT.
 Return the name of the buffer as a string.
@@ -8178,7 +8185,8 @@ from the list of completions and default values."
               (set (make-local-variable 'icomplete-with-completion-tables)
                    (cons rbts-completion-table
                          icomplete-with-completion-tables))))
-      (read-buffer prompt (other-buffer (current-buffer))
+      (read-buffer prompt (other-buffer (current-buffer)
+                                        switch-to-buffer-visible-ok)
                    (confirm-nonexistent-file-or-buffer)))))
 
 (defun window-normalize-buffer-to-switch-to (buffer-or-name)
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2020-03-18  5:36 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25 21:24 bug#37514: PATCH: Add setting to allow switching to an already-visible buffer by default Jefferson Carpenter
2019-09-26  7:12 ` Eli Zaretskii
2019-09-26 19:13   ` Jefferson Carpenter
2019-09-26 19:14     ` Jefferson Carpenter
2019-09-27  8:16     ` martin rudalics
2019-09-28 21:00       ` Jefferson Carpenter
2019-10-02  3:36         ` Jefferson Carpenter
2019-10-02  8:54           ` martin rudalics
2019-10-04  0:45             ` Jefferson Carpenter
2019-10-05  8:42               ` martin rudalics
2019-10-05  9:30                 ` Eli Zaretskii
2020-01-20 19:35             ` Stefan Kangas
2020-03-18  5:36               ` Stefan Kangas
2019-10-07  4:25       ` Lars Ingebrigtsen
2019-10-07  9:26         ` martin rudalics
2019-10-07 18:09           ` Juri Linkov
2019-10-08  8:45             ` martin rudalics
2019-10-09 18:48               ` Juri Linkov
2019-10-12 20:47                 ` Juri Linkov
2019-10-13  8:17                   ` martin rudalics
2019-10-08 16:32             ` Lars Ingebrigtsen
2019-10-09 20:50               ` Juri Linkov
2019-10-09 20:59                 ` Lars Ingebrigtsen
2019-10-11  8:16                   ` martin rudalics
2019-10-07 12:04         ` Robert Pluim
2019-10-08  8:42           ` martin rudalics
2019-10-08 11:42             ` Robert Pluim
2019-09-26  7:20 ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).