bug#81556: 32.0.50; [PATCH] Make speedbar user options for hiding directories or files
Sean Whitton <[email protected]> Wed, 05 Aug 2026 15:13:54 +0100
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Protesilaos [05/Aug 5:04pm +03] wrote: > 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. "can be set to nil" isn't the best wording because you can already set them to nil, it's just not advisable. > 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." Instead of just appending to the end of the docstring, rewrite the whole thing. For example the first line can be "How to match directories not to show in speedbar." > @@ -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)))) This implies that a non-nil, non-string value of the option also means to match all files, but that's confusing. So I suggest just testing that the variables are non-nil and if the user passes a non-string string-match will signal an error, which seems useful. -- Sean Whitton