bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53255: highlight-regexp should show faces with their properties appl


From: Juri Linkov
Subject: bug#53255: highlight-regexp should show faces with their properties applied when selecting a face
Date: Sun, 23 Jan 2022 20:45:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> This has such regression that before it supported the following workflow:
>> in the minibuffer 'M-n M-n ...' used to pull hi-lock faces from the ordered
>> "future history" list.  But read-face-name doesn't support this feature.
>>
>> If highlight-regexp should use read-face-name, then this feature
>> could be added to read-face-name.  Here is the simplest patch,
>> but it would be a tough task to explain the need of an additional
>> DEFAULTS arg in the documentation.  An alternative would be to
>> rewrite read-face-name and keep cdr of the existing arg DEFAULT
>> for the future history of the minibuffer.
>
> Hm, I assumed that that was what read-face-name did (since it allows
> DEFAULT to be a list).

Then read-face-name should be improved to support a list of defaults:

diff --git a/lisp/faces.el b/lisp/faces.el
index bb9b1e979f..c03a0ff8c1 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1081,6 +1081,7 @@ read-face-name
 element of DEFAULT is returned.  If DEFAULT isn't a list, but
 MULTIPLE is non-nil, a one-element list containing DEFAULT is
 returned.  Otherwise, DEFAULT is returned verbatim."
+  (let (defaults)
     (unless (listp default)
       (setq default (list default)))
     (when default
@@ -1090,7 +1091,7 @@ read-face-name
                            default ", ")
               ;; If we only want one, and the default is more than one,
               ;; discard the unwanted ones.
-            (setq default (car default))
+              (setq defaults default default (car default))
               (if (symbolp default)
                   (symbol-name default)
                 default))))
@@ -1137,8 +1138,8 @@ read-face-name
         (let ((face (completing-read
                      prompt
                      (completion-table-in-turn nonaliasfaces aliasfaces)
-                   nil t nil 'face-name-history default)))
-        (if (facep face) (intern face))))))
+                     nil t nil 'face-name-history defaults)))
+          (if (facep face) (intern face)))))))
 
 ;; Not defined without X, but behind window-system test.
 (defvar x-bitmap-file-path)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]