From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#68949: [PATCH] Optionally show internal buffers in Buffer Menu mode Date: Tue, 6 Feb 2024 13:24:30 +0100 Message-ID: <0390E086-FAEF-4012-AF03-F115B125C1A2@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_9A2D58F5-9651-4253-9693-29A1524396B4" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38032"; mail-complaints-to="usenet@ciao.gmane.io" To: 68949@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 06 13:25:00 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rXKVX-0009fy-F0 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Feb 2024 13:24:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXKVQ-0005Gy-0y; Tue, 06 Feb 2024 07:24:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXKVO-0005Gi-81 for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 07:24:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXKVN-0002Oo-VZ for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 07:24:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rXKVa-0003Kj-JL for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 07:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Feb 2024 12:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68949 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Emacs Bug Report Original-Received: via spool by submit@debbugs.gnu.org id=B.170722230112799 (code B ref -1); Tue, 06 Feb 2024 12:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Feb 2024 12:25:01 +0000 Original-Received: from localhost ([127.0.0.1]:53345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXKVZ-0003KN-ER for submit@debbugs.gnu.org; Tue, 06 Feb 2024 07:25:01 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:42708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXKVX-0003KA-QV for submit@debbugs.gnu.org; Tue, 06 Feb 2024 07:25:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXKVF-0005GC-Cy for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 07:24:41 -0500 Original-Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXKVA-0002NI-Bz for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 07:24:41 -0500 Original-Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-51032e62171so8935805e87.3 for ; Tue, 06 Feb 2024 04:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707222272; x=1707827072; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=yT1JTIHdB8a9uwqpActBVpkM6oYC93a6IfgIhVMjPjs=; b=OaEi3VFMii6WT/mfmpmnrilsMjvxYgnRf+ClK49jjSGbeqFNN7fMXt6wZrtQB0L9PV jd3zxUc4YoLr27cSpVAcEJASFywmNO3/2968qo5JUWjA/M6K8LS5ci+rg/5NWfHfKyjF pPZxarQqYmN9OfbmllKca6YJjiGJk4m3hpefmHOlfN8y294YI41PgV/W4CpBP3GPGOpD inysRQXCmHGtfebp3M8s01bu0bSXL5GHyUTWshd91pMCvd3Zk+PEM7JLpq4wsgvIZS32 bpIrJ5OnpbHipN/70quKUoqQS/gXiCJIbEc0V9nXnLaMFB9jqs/ywXnLTQr+IOUBGd0H G4fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707222272; x=1707827072; h=to:date:message-id:subject:mime-version:from:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yT1JTIHdB8a9uwqpActBVpkM6oYC93a6IfgIhVMjPjs=; b=T98jsfVl2QHG1EXhp5+OIDtYZcd8AckpTvwKp/BHQhW2xGVpm1rarf2icA99gBhcKW lfEu3lCMqyYx9VsBHQGpLkrM7drjt9FtiJvoYfPeX2+MEc1KHHnN6iNYVml6s/vZG1dD WzEnx+Sz1yKl3hewio0qRCkluSx0uHiEYQIp8IVAuNBNxnq/uuhoTybMJDUtqD1ZtWKs rsZOJXeMRk6cJXX6Hdg6gSxy1VV56sILw9w1R8MpYR4qvi7ga+ilcv8WZKSMwqF00IvM dGM5aSn453wHT+pdc5dRsSAsJHBtYaz0Wl3ThrQYjh1ZNaq3TfJWS2DAeVWy6z1vBSgC uuyw== X-Gm-Message-State: AOJu0Yw9b53lUa7g8q9mPO0EvXijxMWB0/GsHLP1DDPCCBEf/oFWcAk2 +wbTcfR1RgDak0giWsaVdseEZmsKGo4XaLur5eEpsaHIaokZ4VQDaksZEDMV X-Google-Smtp-Source: AGHT+IHbogfNJ0L9Yd2u3f2k+vvVG8M7IeKtmk75M93siaWVmce+qG7BA2qYXwdhuhX9MGMe5HLaig== X-Received: by 2002:a05:6512:33cc:b0:50e:a789:dd3b with SMTP id d12-20020a05651233cc00b0050ea789dd3bmr2058628lfg.1.1707222271595; Tue, 06 Feb 2024 04:24:31 -0800 (PST) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id q15-20020ac2528f000000b005113fa5be95sm225060lfm.85.2024.02.06.04.24.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2024 04:24:31 -0800 (PST) X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x12d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279484 Archived-At: --Apple-Mail=_9A2D58F5-9651-4253-9693-29A1524396B4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii `list-buffers` (C-x C-b) never shows internal buffers but it would = sometimes be very useful if it did. This patch adds a toggle. --Apple-Mail=_9A2D58F5-9651-4253-9693-29A1524396B4 Content-Disposition: attachment; filename=buff-menu-show-internal.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="buff-menu-show-internal.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 5796544c534..512ee608edb 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -100,6 +100,10 @@ Buffer-menu-files-only This is set by the prefix argument to `buffer-menu' and related commands.") +(defvar-local Buffer-menu-show-internal nil + "Non-nil if the current Buffer Menu lists internal buffers. +Internal buffers are those whose name start with a space.") + (defvar-local Buffer-menu-filter-predicate nil "Function to filter out buffers in the buffer list. Buffers that don't satisfy the predicate will be skipped. @@ -140,6 +144,7 @@ Buffer-menu-mode-map "V" #'Buffer-menu-view "O" #'Buffer-menu-view-other-window "T" #'Buffer-menu-toggle-files-only + "I" #'Buffer-menu-toggle-internal "M-s a C-s" #'Buffer-menu-isearch-buffers "M-s a C-M-s" #'Buffer-menu-isearch-buffers-regexp "M-s a C-o" #'Buffer-menu-multi-occur @@ -197,6 +202,10 @@ Buffer-menu-mode-menu :help "Toggle whether the current buffer-menu displays only file buffers" :style toggle :selected Buffer-menu-files-only] + ["Show Internal Buffers" Buffer-menu-toggle-internal + :help "Toggle whether the current buffer-menu displays internal buffers" + :style toggle + :selected Buffer-menu-show-internal] "---" ["Refresh" revert-buffer :help "Refresh the *Buffer List* buffer contents"] @@ -317,6 +326,11 @@ list-buffers (interactive "P") (display-buffer (list-buffers-noselect arg))) +(defun Buffer-menu--selection-message () + (message (cond (Buffer-menu-files-only "Showing only file-visiting buffers.") + (Buffer-menu-show-internal "Showing all buffers.") + (t "Showing all non-internal buffers.")))) + (defun Buffer-menu-toggle-files-only (arg) "Toggle whether the current `buffer-menu' displays only file buffers. With a positive ARG, display only file buffers. With zero or @@ -325,9 +339,18 @@ Buffer-menu-toggle-files-only (setq Buffer-menu-files-only (cond ((not arg) (not Buffer-menu-files-only)) ((> (prefix-numeric-value arg) 0) t))) - (message (if Buffer-menu-files-only - "Showing only file-visiting buffers." - "Showing all non-internal buffers.")) + (Buffer-menu--selection-message) + (revert-buffer)) + +(defun Buffer-menu-toggle-internal (arg) + "Toggle whether the current `buffer-menu' displays internal buffers. +With a positive ARG, display non-internal buffers only. With zero or +negative ARG, display internal buffers as well." + (interactive "P" Buffer-menu-mode) + (setq Buffer-menu-show-internal + (cond ((not arg) (not Buffer-menu-show-internal)) + ((> (prefix-numeric-value arg) 0) t))) + (Buffer-menu--selection-message) (revert-buffer)) (define-obsolete-function-alias 'Buffer-menu-sort 'tabulated-list-sort @@ -667,6 +690,7 @@ list-buffers--refresh (marked-buffers (Buffer-menu-marked-buffers)) (buffer-menu-buffer (current-buffer)) (show-non-file (not Buffer-menu-files-only)) + (show-internal Buffer-menu-show-internal) (filter-predicate (and (functionp Buffer-menu-filter-predicate) Buffer-menu-filter-predicate)) entries name-width) @@ -686,7 +710,8 @@ list-buffers--refresh (file buffer-file-name)) (when (and (buffer-live-p buffer) (or buffer-list - (and (or (not (string= (substring name 0 1) " ")) + (and (or show-internal + (not (string= (substring name 0 1) " ")) file) (not (eq buffer buffer-menu-buffer)) (or file show-non-file) --Apple-Mail=_9A2D58F5-9651-4253-9693-29A1524396B4--