unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: ndame <laszlomail@protonmail.com>
Cc: 53255@debbugs.gnu.org
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	[thread overview]
Message-ID: <87y23hl729.fsf@gnus.org> (raw)
In-Reply-To: <vdRmF318m4VtwQ0wPesl7HHiE_9gEAtLPZr5mJKxZPWZVOt_uSmFZlDEYKrS3XQ2-mjOgsudPmn3iCSWyXUUYYrRDBALWp1E289tijdAAMk=@protonmail.com> (ndame's message of "Fri, 14 Jan 2022 13:37:13 +0000")

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

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:


[-- Attachment #2: Type: image/png, Size: 95517 bytes --]

[-- Attachment #3: Type: text/plain, Size: 1444 bytes --]


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	other threads:[~2022-01-15  8:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 13:37 bug#53255: highlight-regexp should show faces with their properties applied when selecting a face ndame via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15  8:46 ` Lars Ingebrigtsen [this message]
2022-01-15 10:05   ` Kévin Le Gouguec
2022-01-15 10:11     ` Lars Ingebrigtsen
2022-01-15 11:36       ` Kévin Le Gouguec
2022-01-15 19:14         ` Juri Linkov
2022-01-15 22:48         ` bug#53255: [External] : " Drew Adams
2022-01-20 13:23         ` Lars Ingebrigtsen
2022-01-20 22:58           ` Kévin Le Gouguec
2022-01-21  6:32             ` Kévin Le Gouguec
2022-01-21  9:30             ` Lars Ingebrigtsen
2022-01-21 13:39               ` Kévin Le Gouguec
2022-01-22 11:36                 ` Lars Ingebrigtsen
2022-01-21 17:06               ` bug#53255: [External] : " Drew Adams
2022-01-22 18:51           ` Juri Linkov
2022-01-23 12:38             ` Lars Ingebrigtsen
2022-01-23 18:45               ` Juri Linkov
2022-01-24  9:22                 ` Lars Ingebrigtsen
2022-01-15 22:40       ` bug#53255: [External] : " Drew Adams
2022-01-15 22:31     ` Drew Adams
2022-01-15 19:12   ` Juri Linkov
2022-01-16 18:20     ` Juri Linkov
2022-01-15 21:46   ` bug#53255: [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y23hl729.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=53255@debbugs.gnu.org \
    --cc=laszlomail@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).