]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix thinko in previous hi-lock-read-face-name change
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 13:53:12 +0000 (14:53 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 20 Jan 2022 13:53:12 +0000 (14:53 +0100)
* lisp/hi-lock.el (hi-lock-read-face-name): Fix the string/symbol
logic.

lisp/hi-lock.el
test/lisp/hi-lock-tests.el

index 081b604d5b2f94c75259ded565ec475fcfc417b2..53e6f779b319b7f2e897cb1410e3e32c3bec96f3 100644 (file)
@@ -729,9 +729,10 @@ with completion and history."
         face)
     (if (and hi-lock-auto-select-face (not current-prefix-arg))
        (setq face (or (pop hi-lock--unused-faces) (car defaults)))
-      (setq face (read-face-name
-                  (format-prompt "Highlight using face" (car defaults))
-                  defaults))
+      (setq face (symbol-name
+                  (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.
index 71983c713d249043c9a031ebacb1fb45407d6ed0..760b319a9262165c65edcc6290fdb7ebfda95291 100644 (file)
   (let ((faces hi-lock-face-defaults))
     (with-temp-buffer
       (insert "a A b B\n")
-      (cl-letf (((symbol-function 'completing-read)
-                   (lambda (_prompt _coll
-                                    &optional _x _y _z _hist defaults _inherit)
-                     (car defaults))))
+      (cl-letf (((symbol-function 'read-face-name)
+                   (lambda (_prompt &optional defaults)
+                     (intern (car defaults)))))
         (dotimes (_ 2)
           (let ((face (hi-lock-read-face-name)))
             (hi-lock-set-pattern "a" face))))
   (let ((faces hi-lock-face-defaults))
     (with-temp-buffer
       (insert "foo bar")
-      (cl-letf (((symbol-function 'completing-read)
-                 (lambda (_prompt _coll
-                                  &optional _x _y _z _hist defaults _inherit)
-                   (car defaults))))
+      (cl-letf (((symbol-function 'read-face-name)
+                   (lambda (_prompt &optional defaults)
+                     (intern (car defaults)))))
         (hi-lock-set-pattern "9999" (hi-lock-read-face-name)) ; No match
         (hi-lock-set-pattern "foo" (hi-lock-read-face-name)))
       ;; Only one match, then we have used just 1 face