bug#81556: 32.0.50; [PATCH] Make speedbar user options for hiding directories or files
Protesilaos <[email protected]> Wed, 05 Aug 2026 17:04:17 +0300
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Dear maintainters, The attached patch makes it easier to tell M-x speedbar to just show every directory and every file. Without this kind of change, I have to resort to writing a regexp that never matches any real directories/files, which looks strange. All the best, Protesilaos (or simply "Prot")
0001-Make-speedbar-user-options-for-hiding-directories-or.patch
(text/x-diff, 3.5 KB)
From daa776f7a35cd34f770b3a3b58dd553583368d31 Mon Sep 17 00:00:00 2001 Message-ID: <daa776f7a35cd34f770b3a3b58dd553583368d31.1785938468.git.info@protesilaos.com> From: Protesilaos <[email protected]> Date: Wed, 5 Aug 2026 17:00:58 +0300 Subject: [PATCH] Make speedbar user options for hiding directories or files accept nil value * etc/NEWS: Announce the changes. * lisp/speedbar.el (speedbar-directory-unshown-regexp) (speedbar-file-unshown-regexp): Add choice for nil. (speedbar-file-lists): Check that the user options 'speedbar-directory-unshown-regexp' and 'speedbar-file-unshown-regexp' are strings before using them. --- etc/NEWS | 10 ++++++++++ lisp/speedbar.el | 24 ++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 3aba7e9db15..00b32d5ec0d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -248,6 +248,16 @@ Markdown files fall back to 'text-mode'. To install the grammars, use 'M-x markdown-ts-mode-install-parsers'. +** Speedbar + +--- +*** The user option 'speedbar-directory-unshown-regexp' can be set to 'nil' +This means that all directories will be displayed. + +--- +*** The user option 'speedbar-file-unshown-regexp' can be set to 'nil' +This means that all files will be displayed. + * Incompatible Lisp Changes in Emacs 32.1 diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 08af40a0aca..adfc4491fe8 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -664,9 +664,14 @@ (defcustom speedbar-directory-unshown-regexp "^\\(\\..*\\)\\'" "Regular expression matching directories not to show in speedbar. They should include commonly existing directories which are not useful. It is no longer necessary to include version-control -directories here; see `vc-directory-exclusion-list'." +directories here; see `vc-directory-exclusion-list'. + +If nil, then all directories are displayed." :group 'speedbar - :type 'regexp) + :type '(choice + (regexp :tag "Filter by regular expression") + (const :tag "No filter" nil)) + :version "32.1") (defcustom speedbar-file-unshown-regexp (let ((nstr "") (noext completion-ignored-extensions)) @@ -677,9 +682,14 @@ (defcustom speedbar-file-unshown-regexp ;; backup refdir lockfile (concat nstr "\\|#[^#]+#$\\|\\.\\.?\\'\\|\\.#")) "Regexp matching files we don't want displayed in a speedbar buffer. -It is generated from the variable `completion-ignored-extensions'." +It is generated from the variable `completion-ignored-extensions'. + +If nil, then all files are displayed." :group 'speedbar - :type 'regexp) + :type '(choice + (regexp :tag "Filter by regular expression") + (const :tag "No filter" nil)) + :version "32.1") (defvar speedbar-file-regexp nil "Regular expression matching files we know how to expand. @@ -2002,9 +2012,11 @@ (defun speedbar-file-lists (directory) (files nil)) (while dir (if (not - (or (string-match speedbar-file-unshown-regexp (car dir)) + (or (and (stringp speedbar-file-unshown-regexp) + (string-match speedbar-file-unshown-regexp (car dir))) (member (car dir) vc-directory-exclusion-list) - (string-match speedbar-directory-unshown-regexp (car dir)))) + (and (stringp speedbar-directory-unshown-regexp) + (string-match speedbar-directory-unshown-regexp (car dir))))) (if (file-directory-p (car dir)) (setq dirs (cons (car dir) dirs)) (setq files (cons (car dir) files)))) -- 2.47.3