0

How can I pass the face to describe-face when using the function interactively?

(defun laxy-describe-face (face)
  "TODO"

  (interactive
   (list
    (let* ( (cseq '("mode-line-inactive" "mode-line")) )
      (completing-read "Face: " cseq nil t "mode-line"))))

  (describe-face 'face))
8
  • You're code is correct, you should just remove the quote from tha last 'face Commented Aug 8, 2022 at 19:48
  • Would completing-read only get me a string and might need a form of intern call?
    – Dilna
    Commented Aug 8, 2022 at 19:53
  • Why don't you try it? (describe-face "modeline-inactive") and (describe-face 'mode-line-inactive) both work: describe-face does the interning if necessary. You can look at the code and see for yourself: C-h f describe-face and then click on the source link at the end of the first sentence in the *Help* buffer.
    – NickD
    Commented Aug 8, 2022 at 20:03
  • I only looked at C-h f describe-face which says the argument has to be FACE.
    – Dilna
    Commented Aug 8, 2022 at 20:12
  • 1
    if (stringp f) (setq f (intern f))): yup, that's it.
    – NickD
    Commented Aug 8, 2022 at 22:18

0

Browse other questions tagged or ask your own question.