Here's the situation: I need to retrieve the face's under point boundaries, but if I use highlight-current-line mode, that face overlays the face that I'm interested in.
face-at-point
or (get-char-property (point) 'face)
will only give me the first face in the list, and it will be the one from the current-line overlay. How to get the underlying faces?
EDIT:
This is more or less what I ended up doing:
(defun haxe-face-at-point ()
"This is like `face-at-point' except we will only look for faces
which are relevant to haxe-mode. This will also look under overlays
created by minor modes like ispel or highlight current line."
(interactive)
(let ((props (text-properties-at (point))))
(catch 't
(while props
(when (eql (car props) 'face)
(throw 't
(when (member (cadr props)
'(font-lock-string-face
font-lock-keyword-face
font-lock-variable-name-face
font-lock-comment-face
font-lock-preprocessor-face
font-lock-type-face
default))
(cadr props))))
(setq props (cdr props))))))
I only needed to find out if there's one of the list anyways.
There are sadly no good facilities provided to Elisp code for that. The best I can offer you is to use overlays-at
and then loop through the result, using overlay-get
to see which ones of the overlays specifies a face
and finally use get-text-property
to get the face
specified by the text-properties (if any). The display engine combines all those.