Refactor doom/what-face

This commit is contained in:
Henrik Lissner 2017-09-15 13:49:00 +02:00
parent 42e7f56a1f
commit d5b84eee3d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -7,18 +7,13 @@
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."
(interactive)
(unless pos
(setq pos (point)))
(let ((faces (let ((face (get-text-property pos 'face)))
(if (keywordp (car-safe face))
(list face)
(cl-loop for f in (if (listp face) face (list face))
collect f))))
(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))))
(let* ((pos (or pos (point)))
(faces (let ((face (get-text-property pos 'face)))
(if (keywordp (car-safe face))
(list face)
(cl-loop for f in (doom-enlist face) collect f))))
(overlays (cl-loop for ov in (overlays-at pos (1+ pos))
nconc (doom-enlist (overlay-get ov 'face)))))
(cond ((called-interactively-p 'any)
(message "%s %s\n%s %s"
(propertize "Faces:" 'face 'font-lock-comment-face)