]> git.eshelyaron.com Git - emacs.git/commitdiff
Make the read-face-name completion buffer display samples
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 13:22:05 +0000 (14:22 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 13:22:05 +0000 (14:22 +0100)
* 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
lisp/hi-lock.el

index df099787698805b0b2c68e4a39a57f26f560e5d7..bb9b1e979fa427fdd95a35991120d81490bd7866 100644 (file)
@@ -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)
index b77f9181a9c8c6cc887fc7586ab874beb453fda6..081b604d5b2f94c75259ded565ec475fcfc417b2 100644 (file)
@@ -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.