I am using this function interactively, where the string from completing-read
is passed to intern
to convert it into a symbol suitable for describe-face
.
Currently, I want to handle the non-interactive case, where a face is passed directly to the function. The strategy is to add a condition alternative for a face or face name, that I can call describe-face
with that face as a single argument.
Perhaps using stringp
for face names and facep
for faces.
Is this ok, can it be improved?
(defun laxy-descface (facenm)
"Describe the typeface properties of face name FACENM."
(interactive
(list
(let* ( (cseq '("default" "mode-line" "mode-line-inactive"
"list" "text-property")) )
(completing-read "Face_property: " cseq nil t "text-property"))))
(cond
((stringp facenm)
(pcase facenm
("text-property"
(describe-face (get-text-property (point) 'face)))
("default"
(describe-face (intern facenm)))
("mode-line"
(describe-face (intern facenm)))
("mode-line-inactive"
(describe-face (intern facenm)))
("list"
(list-faces-display))) )
((facep facenm)
(describe-face facenm))))