From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.devel Subject: Allow controlling the effect of visibility on buffer switching Date: Wed, 26 Jan 2022 12:10:38 +0300 Message-ID: <87a6fi3lrl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11346"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 26 13:09:21 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCh72-0002mP-UW for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jan 2022 13:09:20 +0100 Original-Received: from localhost ([::1]:41458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCh6z-0005m2-Vs for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jan 2022 07:09:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCeKC-0005hc-DB for emacs-devel@gnu.org; Wed, 26 Jan 2022 04:10:44 -0500 Original-Received: from [2a00:1450:4864:20::530] (port=40735 helo=mail-ed1-x530.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCeKA-0006zO-OK for emacs-devel@gnu.org; Wed, 26 Jan 2022 04:10:43 -0500 Original-Received: by mail-ed1-x530.google.com with SMTP id a18so67810763edj.7 for ; Wed, 26 Jan 2022 01:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=LabKg7yQrhwUf/1L3mdDwXdjKo//GwISYswi84iH+sU=; b=PjaHAYa35jvg6bSE+t9/B2mnnfLthEz2V2cHZHYOJC1nTXfA7Vk/+Bf/DmnPFN1yNM t85qqEv1AN3wblO1vHNGjXkTIY0gNQthM75AJf+4/IWBpvWpd42cgSLD6jyp5ridK3eu tHdkBJMfRBK4C0fyGoLKhN5hu5tHLZst1CEb3CRkqNOeVDDeQ6G8OXVdFTisRjJSi7bd mIJ+PN/Lole4uznTG62YFxXqqF4Moi7BDDtaeQeUsI73U2nV1GQ6s/O5+CpRYvN/TQB7 Mp3/npQlCqrS+dX/3yezHq3/4omKsuN9J4FbDBwac9lp3x3dd/tvHlGOFxcKOBwh+/Kw z/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=LabKg7yQrhwUf/1L3mdDwXdjKo//GwISYswi84iH+sU=; b=Ya2Bh0AGwz6WJkB9uxgPh4rt+nUQZttHWTfMK5CYMaMNoPYVAMw9/nBZ8Ur23z68Vx bsx4ZLOWgNXwHvsiiHxtJzgpSnrC9siYmypxvJwzCxN/kq2Q9rBckwmg4oZAv+hiw5UN PllFKb5Vb36ncky3kki+IIARZqyC0BqmsRPLf+KUH67OIEA/ySaAKXPTXiZXAfnfI2/t ZhfWRStlpkTKgJbMA2i6J0cOROlp2+jHnY7FmKdmhHxWx62ZBTO/uOQl4GY/Dg0Yl0HU wlRTDi5Ifbyh+Gwnsg78K98KAZ5L4ASrl5jzTXUmMrRK3HSg66h2PJDbUIXXw7b22R55 bgjg== X-Gm-Message-State: AOAM531zjX1OrDPcJPLlJa09hd9Co8zXl25t4qdGsHERWkPKt7whUeAr LXfpealzJlk60SsA/TjG2JhTpHL2IKQ= X-Google-Smtp-Source: ABdhPJyJKl63UPr1NgJwWsqktPdw63F+kykmWGD3iftqJvbd0QYlG0qOqJjJpoiPMksyTJtU5D+1ww== X-Received: by 2002:a05:6402:5106:: with SMTP id m6mr15227559edd.292.1643188240584; Wed, 26 Jan 2022 01:10:40 -0800 (PST) Original-Received: from Thuna ([78.161.73.233]) by smtp.gmail.com with ESMTPSA id z25sm9507810edm.60.2022.01.26.01.10.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 01:10:39 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::530 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=thuna.cing@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 26 Jan 2022 07:06:03 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285419 Archived-At: --=-=-= Content-Type: text/plain 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): --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Allow-controlling-the-effect-of-visibility-on-buffer.patch >From a4c2d922e2fc0cd48c95df9622d6f06541f38901 Mon Sep 17 00:00:00 2001 From: Thuna 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 --=-=-= Content-Type: text/plain 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. --=-=-=--