all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Allow controlling the effect of visibility on buffer switching
@ 2022-01-26  9:10 Thuna
  2022-01-26 13:30 ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Thuna @ 2022-01-26  9:10 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

Currently `read-buffer-to-switch' defaults to non-visible buffers.  An
option to control this behavior could be introduced as follows (a
proof-of-concept, subject to change):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-controlling-the-effect-of-visibility-on-buffer.patch --]
[-- Type: text/x-diff, Size: 1441 bytes --]

From a4c2d922e2fc0cd48c95df9622d6f06541f38901 Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@gmail.com>
Date: Wed, 26 Jan 2022 11:56:17 +0300
Subject: [PATCH] Allow controlling the effect of visibility on buffer
 switching

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

diff --git a/lisp/window.el b/lisp/window.el
index 582600e1c6..ffc09486ef 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8575,6 +8575,12 @@ display-comint-buffer-action
   :group 'windows
   :group 'comint)
 
+(defcustom switch-to-buffer-ignore-visibility nil
+  "If nil, `read-buffer-to-switch' prefer buffers not visible as
+the default buffer to switch to."
+  :type 'boolean
+  :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.
@@ -8595,7 +8601,9 @@ read-buffer-to-switch
               (setq-local 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-ignore-visibility)
                    (confirm-nonexistent-file-or-buffer)))))
 
 (defun window-normalize-buffer-to-switch-to (buffer-or-name)
-- 
2.25.1


[-- Attachment #3: Type: text/plain, Size: 256 bytes --]


There are other functions that might need to have this change applied to
them as well, I imagine.

Autocompletion frameworks would also need to adapt; helm and ivy would
need to fix `helm-mode--read-buffer-to-switch' and `ivy-switch-buffer'
respectively.

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

end of thread, other threads:[~2022-01-30 16:51 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-26  9:10 Allow controlling the effect of visibility on buffer switching Thuna
2022-01-26 13:30 ` Eli Zaretskii
2022-01-26 13:46   ` Thuna
2022-01-26 15:01     ` Eli Zaretskii
2022-01-27  3:18       ` Matt Armstrong
2022-01-27 18:16         ` Thuna
2022-01-27  4:25       ` Michael Welsh Duggan
2022-01-27 17:09       ` Juri Linkov
2022-01-29  7:48       ` Thuna
2022-01-29  8:14         ` Eli Zaretskii
2022-01-29  8:35           ` Thuna
2022-01-29  9:37         ` Po Lu
2022-01-29 15:27           ` Michael Welsh Duggan
2022-01-29 20:03             ` chad
2022-01-30  7:06               ` Po Lu
2022-01-30  0:31           ` Stefan Monnier
2022-01-30  6:42             ` Eli Zaretskii
2022-01-30 16:08               ` Stefan Monnier
2022-01-30 16:51                 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.