Fix doom/what-face not handling face plist specs
This commit is contained in:
parent
f1c34fba72
commit
ca222c1b75
1 changed files with 30 additions and 15 deletions
|
@ -3,21 +3,36 @@
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/what-face (&optional pos)
|
(defun doom/what-face (&optional pos)
|
||||||
"Lists all faces at point. Overlay faces are denoted with an asterix."
|
"Lists all faces at point. Overlay faces are denoted with an asterix."
|
||||||
(interactive "d")
|
(interactive)
|
||||||
(let ((pos (or pos (point)))
|
(unless pos
|
||||||
faces)
|
(setq pos (point)))
|
||||||
(when-let (face (get-text-property pos 'face))
|
(let ((faces (let ((face (get-text-property pos 'face)))
|
||||||
(dolist (f (if (listp face) face (list face)))
|
(if (keywordp (car-safe face))
|
||||||
(push (propertize (symbol-name f) 'face f) faces)))
|
(list face)
|
||||||
(dolist (ov (overlays-at pos (1+ pos)))
|
(cl-loop for f in (if (listp face) face (list face))
|
||||||
(let ((face (overlay-get ov 'face)))
|
collect f))))
|
||||||
(dolist (f (if (listp face) face (list face)))
|
(overlays (cl-loop for ov in (overlays-at pos (1+ pos))
|
||||||
(push (propertize (concat (symbol-name f) "*") 'face f) faces))))
|
nconc (cl-loop with face = (overlay-get ov 'face)
|
||||||
(if (called-interactively-p 'any)
|
for f in (if (listp face) face (list face))
|
||||||
(message "%s %s"
|
collect f))))
|
||||||
(propertize "Faces:" 'face 'font-lock-comment-face)
|
|
||||||
(if faces (string-join faces ", ") "n/a"))
|
(cond ((called-interactively-p 'any)
|
||||||
(mapcar #'substring-no-properties faces))))
|
(message "%s %s; %s"
|
||||||
|
(propertize "Faces:" 'face 'font-lock-comment-face)
|
||||||
|
(if faces
|
||||||
|
(cl-loop for face in faces
|
||||||
|
if (listp face)
|
||||||
|
concat (format "'%s " face)
|
||||||
|
else
|
||||||
|
concat (concat (propertize (symbol-name face) 'face face) " "))
|
||||||
|
"n/a ")
|
||||||
|
(if overlays
|
||||||
|
(cl-loop for ov in overlays
|
||||||
|
concat (concat (propertize (symbol-name ov) 'face ov) " "))
|
||||||
|
"n/a")))
|
||||||
|
(t
|
||||||
|
(and (or faces overlays)
|
||||||
|
(list faces overlays))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-active-minor-modes ()
|
(defun doom-active-minor-modes ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue