unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: ndame <laszlomail@protonmail.com>, 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 12:36:46 +0100	[thread overview]
Message-ID: <87v8ylnsc1.fsf@gmail.com> (raw)
In-Reply-To: <877db1wboq.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 15 Jan 2022 11:11:33 +0100")

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

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> Maybe using an affixation function (like read-char-by-name) would make
>> things less jarring?  E.g. fontifying the same string for every face
>> (say "x" or "example") and using that as suffix (rather than prefix, to
>> keep the face names aligned)?
>
> Hm, yes, that sounds like a good idea.

Serving suggestion attached, for discussion purposes; there might be
smarter things to do wrt alignment (using :align-to specs?  let-binding
tab-width?).

FWIW it looks pretty good with icomplete-vertical-mode, IMO.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hi-lock.patch --]
[-- Type: text/x-patch, Size: 1005 bytes --]

diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index b70d4a7569..05584b8dc3 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -712,6 +712,13 @@ hi-lock-regexp-okay
     (error "Regexp cannot match an empty string"))
    (t regexp)))
 
+(defun hi-lock-decorate-face-names (faces)
+  (mapcar
+   (lambda (face)
+     (list face "" (concat "\t"
+                    (propertize "EXAMPLE" 'face (intern-soft face)))))
+   faces))
+
 (defun hi-lock-read-face-name ()
   "Return face for interactive highlighting.
 When `hi-lock-auto-select-face' is non-nil, just return the next face.
@@ -726,6 +733,8 @@ hi-lock-read-face-name
 	 (defaults (append hi-lock--unused-faces
 			   (cdr (member last-used-face hi-lock-face-defaults))
 			   hi-lock-face-defaults))
+         (completion-extra-properties
+          '(:affixation-function hi-lock-decorate-face-names))
 	 face)
           (if (and hi-lock-auto-select-face (not current-prefix-arg))
 	(setq face (or (pop hi-lock--unused-faces) (car defaults)))

  reply	other threads:[~2022-01-15 11:36 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
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 [this message]
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=87v8ylnsc1.fsf@gmail.com \
    --to=kevin.legouguec@gmail.com \
    --cc=53255@debbugs.gnu.org \
    --cc=larsi@gnus.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).