Avoid byte-compiled code in `ibuffer-maybe-show-predicates' value (bug#80117)

* lisp/ibuffer.el (ibuffer-hidden-buffer-p): New function.
(ibuffer-maybe-show-predicates): Use it.
(ibuffer-fontification-alist): Use it (for consistency).

This prevents byte-compiled code appearing in the *Help* buffer
and in the customize UI for `ibuffer-maybe-show-predicates'.
This commit is contained in:
Phil Sainty 2026-01-02 18:34:25 +13:00
parent 38092d879b
commit 4484a9f875

View file

@ -166,9 +166,7 @@ elisp byte-compiler."
buffer-file-name))
font-lock-doc-face)
(20 (string-match "^\\*" (buffer-name)) font-lock-keyword-face)
(25 (and (string-match "^ " (buffer-name))
(null buffer-file-name))
italic)
(25 (ibuffer-hidden-buffer-p) italic)
(30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face)
(35 (derived-mode-p 'dired-mode) font-lock-function-name-face)
(40 (and (boundp 'emacs-lock-mode) emacs-lock-mode) ibuffer-locked-buffer))
@ -236,9 +234,7 @@ view of the buffers."
"The string to use for eliding long columns."
:type 'string)
(defcustom ibuffer-maybe-show-predicates `(,(lambda (buf)
(and (string-match "^ " (buffer-name buf))
(null buffer-file-name))))
(defcustom ibuffer-maybe-show-predicates '(ibuffer-hidden-buffer-p)
"A list of predicates for buffers to display conditionally.
A predicate can be a regexp or a function.
@ -2035,6 +2031,13 @@ the value of point at the beginning of the line for that buffer."
e)))
bmarklist))))
(defun ibuffer-hidden-buffer-p (&optional buf)
"The default member of `ibuffer-maybe-show-predicates'.
Non-nil if BUF is not visiting a file and its name begins with a space.
BUF defaults to the current buffer."
(and (string-match "^ " (buffer-name buf))
(null (buffer-file-name buf))))
(defun ibuffer-visible-p (buf all &optional ibuffer-buf)
(and (or all
(not