Subject: Re: bug#79481: global-hl-line buffers

From: Juri Linkov <[email-masked]>
Date: Mon, 22 Sep 2025 18:03:06 +0300

>> Recently we added 'tab-line-exclude-buffers'
>> that is checked by 'buffer-match-p'.
>>
>> Shouldn't we now rename 'global-hl-line-modes' to something like
>> 'global-hl-line-buffers' and use 'buffer-match-p', given that it was
>> added in 31.1, so there is no need to provide an alias for deprecation.
>
> I don't have problem with that, you can do the change, IME
> `buffer-match-p` is a better and powerful alternative to
> `easy-mmode--globalized-predicate-p`,

Do you think we should add the word "exclude" to the name?
Or it's fine to require using 'not' in the condition?

> however the `buffer-predicate` type does not have
> a complete UI for `Customize` yet.

Here is the patch that makes possible the customization
of all `buffer-predicate` conditions recursively:

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 311e39f4c0f..4e2e88c7dfa 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -4387,12 +4387,35 @@ 'widget-visibility-value-create
 
 ;;; Buffer predicates.
 (define-widget 'buffer-predicate 'lazy
-  "A buffer predicate."
+  "A buffer predicate for the condition argument of `buffer-match-p'."
   :tag "Buffer predicate"
   :type '(choice (const :tag "All buffers" t)
                  (const :tag "No buffers" nil)
-                 ;; FIXME: This should be expanded somehow.
-                 sexp))
+                 (regexp :tag "Buffer name regexp")
+                 (function :tag "Predicate function")
+                 (cons :tag "Category"
+                       (const category)
+                       (symbol category))
+                 (cons :tag "This command"
+                       (const this-command)
+                       (symbol this-command))
+                 (cons :tag "Major mode"
+                       (const major-mode)
+                       (symbol major-mode))
+                 (cons :tag "Derived mode"
+                       (const derived-mode)
+                       (symbol derived-mode))
+                 (cons :tag "Not"
+                       (const not)
+                       (buffer-predicate :tag "not-condition"))
+                 (cons :tag "Or"
+                       (const or)
+                       (repeat :tag "List of or-conditions"
+                               buffer-predicate))
+                 (cons :tag "And"
+                       (const and)
+                       (repeat :tag "List of and-conditions"
+                               buffer-predicate))))
 
 (provide 'wid-edit)