bug#43339: 27.1; Hi-Lock mode mishandles face names specified as strings
Hi-Lock mode seems to get into an erroneous state when you call its
functions with the face name specified as a string rather than a
symbol. For example, open the scratch buffer and evaluate the following
The comment on the last line shows the value of
hi-lock-interactive-patterns after evaluating the forms. Note the quote
in front of "hi-yellow". Note also that no error has been raised. The
function has apparently worked correctly, and the string "create" is
highlighted in yellow.
Now move point onto some symbol and invoke interactively the command
hi-lock-face-symbol-at-point. There is an error message:
Wrong type argument: symbolp, "hi-yellow"
Hi-Lock is passing this string to the face-name function, but it expects
I think the core issue is that Hi-Lock fails to canonicalize the face
name as a symbol in its internal data structures. It seems to rely on
the underlying faces API to enforce data consistency, but whereas facep
returns non-nil on string inputs, face-name does not allow them.
You might be able to argue that the above is an issue in the faces
library rather than Hi-Lock. I'm not sure if changing something at that
layer would break things elsewhere.
Either way, I think Hi-Lock should probably canonicalize its own data
structures and convert faces to symbols.
Note that everything works correctly when these functions are called
interactively, because the package does convert faces to symbols in
In GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
of 2020-08-12 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.2009
System Description: macOS 11.0
For information about GNU Emacs and the GNU system, type C-h C-a.
(("create" (0 '"hi-yellow" prepend)))
nil [2 times]
Making completion list...
face-name: Wrong type argument: symbolp, "hi-blue"
Making completion list... [2 times]
value of $LANG: en_US.UTF-8
Major mode: Lisp Interaction
Minor modes in effect: