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: Lars Ingebrigtsen
Subject: bug#53255: highlight-regexp should show faces with their properties applied when selecting a face
Date: Sat, 15 Jan 2022 09:46:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

ndame <laszlomail@protonmail.com> writes:

> Like read-color shows the color names with their actual colors, the
> selection of a face should also show the names with their properties
> applied.

The patch below implements this, but it does lead to some strange
effects:

PNG image

That is, some faces have odd sizes, so the completion display may look a
bit odd.

But it does accurately tell you what the result is doing to be, so
perhaps it's OK?  Anybody have any opinions?

diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index b70d4a7569..18e5f73369 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -727,11 +727,16 @@ hi-lock-read-face-name
                           (cdr (member last-used-face hi-lock-face-defaults))
                           hi-lock-face-defaults))
         face)
-          (if (and hi-lock-auto-select-face (not current-prefix-arg))
+    (if (and hi-lock-auto-select-face (not current-prefix-arg))
        (setq face (or (pop hi-lock--unused-faces) (car defaults)))
-      (setq face (completing-read
-                 (format-prompt "Highlight using face" (car defaults))
-                 obarray 'facep t nil 'face-name-history defaults))
+      (let ((completion-extra-properties
+             (list :annotation-function
+                   (lambda (s)
+                     (add-face-text-property
+                      0 (length s) (intern s) t s)))))
+        (setq face (completing-read
+                   (format-prompt "Highlight using face" (car defaults))
+                   obarray 'facep t nil 'face-name-history defaults)))
       ;; Update list of un-used faces.
       (setq hi-lock--unused-faces (remove face hi-lock--unused-faces))
       ;; Grow the list of defaults.


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

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