emacs-diffs
[Top][All Lists]
Advanced

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

master 2de01ff1ba: Make the read-face-name completion buffer display sam


From: Lars Ingebrigtsen
Subject: master 2de01ff1ba: Make the read-face-name completion buffer display samples
Date: Thu, 20 Jan 2022 08:24:42 -0500 (EST)

branch: master
commit 2de01ff1bab09855a37ccb60788c1c35fb569e43
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make the read-face-name completion buffer display samples
    
    * lisp/faces.el (read-face-name): Display face samples when
    completing (bug#53255).
    
    * lisp/hi-lock.el (hi-lock-read-face-name): Use read-face-name.
---
 lisp/faces.el   | 10 ++++++++++
 lisp/hi-lock.el |  8 ++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index df09978769..bb9b1e979f 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1107,6 +1107,16 @@ returned.  Otherwise, DEFAULT is returned verbatim."
   (let ((prompt (if default
                     (format-prompt prompt default)
                   (format "%s: " prompt)))
+        (completion-extra-properties
+         '(:affixation-function
+           (lambda (faces)
+             (mapcar
+              (lambda (face)
+                (list (concat (propertize "SAMPLE" 'face face)
+                              "\t")
+                      ""
+                      face))
+              faces))))
         aliasfaces nonaliasfaces faces)
     ;; Build up the completion tables.
     (mapatoms (lambda (s)
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index b77f9181a9..081b604d5b 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -727,11 +727,11 @@ with completion and history."
                           (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))
+      (setq face (read-face-name
+                  (format-prompt "Highlight using face" (car defaults))
+                  defaults))
       ;; Update list of un-used faces.
       (setq hi-lock--unused-faces (remove face hi-lock--unused-faces))
       ;; Grow the list of defaults.



reply via email to

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