Refactor doom/what-face

This commit is contained in:
Henrik Lissner
2017-09-15 13:49:00 +02:00
parent 42e7f56a1f
commit d5b84eee3d

View File

@ -7,18 +7,13 @@
Interactively prints the list to the echo area. Noninteractively, returns a list Interactively prints the list to the echo area. Noninteractively, returns a list
whose car is the list of faces and cadr is the list of overlay faces." whose car is the list of faces and cadr is the list of overlay faces."
(interactive) (interactive)
(unless pos (let* ((pos (or pos (point)))
(setq pos (point))) (faces (let ((face (get-text-property pos 'face)))
(let ((faces (let ((face (get-text-property pos 'face))) (if (keywordp (car-safe face))
(if (keywordp (car-safe face)) (list face)
(list face) (cl-loop for f in (doom-enlist face) collect f))))
(cl-loop for f in (if (listp face) face (list face)) (overlays (cl-loop for ov in (overlays-at pos (1+ pos))
collect f)))) nconc (doom-enlist (overlay-get ov 'face)))))
(overlays (cl-loop for ov in (overlays-at pos (1+ pos))
nconc (cl-loop with face = (overlay-get ov 'face)
for f in (if (listp face) face (list face))
collect f))))
(cond ((called-interactively-p 'any) (cond ((called-interactively-p 'any)
(message "%s %s\n%s %s" (message "%s %s\n%s %s"
(propertize "Faces:" 'face 'font-lock-comment-face) (propertize "Faces:" 'face 'font-lock-comment-face)