[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6305c3f30d 3/3: Fix thinko in previous hi-lock-read-face-name cha
From: |
Lars Ingebrigtsen |
Subject: |
master 6305c3f30d 3/3: Fix thinko in previous hi-lock-read-face-name change |
Date: |
Thu, 20 Jan 2022 08:53:26 -0500 (EST) |
branch: master
commit 6305c3f30dc12dabad705031cbb296999d39e308
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix thinko in previous hi-lock-read-face-name change
* lisp/hi-lock.el (hi-lock-read-face-name): Fix the string/symbol
logic.
---
lisp/hi-lock.el | 7 ++++---
test/lisp/hi-lock-tests.el | 14 ++++++--------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 081b604d5b..53e6f779b3 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -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.
diff --git a/test/lisp/hi-lock-tests.el b/test/lisp/hi-lock-tests.el
index 71983c713d..760b319a92 100644
--- a/test/lisp/hi-lock-tests.el
+++ b/test/lisp/hi-lock-tests.el
@@ -30,10 +30,9 @@
(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))))
@@ -43,10 +42,9 @@
(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