Function: face-at-point
face-at-point is a byte-compiled function defined in faces.el.gz.
Signature
(face-at-point &optional THING MULTIPLE)
Documentation
Return the face of the character after point.
If it has more than one face, return the first one. If THING is non-nil try first to get a face name from the buffer. IF MULTIPLE is non-nil, return a list of all faces. Return nil if there is no face.
Source Code
;; Defined in /usr/src/emacs/lisp/faces.el.gz
(defun face-at-point (&optional thing multiple)
"Return the face of the character after point.
If it has more than one face, return the first one.
If THING is non-nil try first to get a face name from the buffer.
IF MULTIPLE is non-nil, return a list of all faces.
Return nil if there is no face."
(let (faces)
(if thing
;; Try to get a face name from the buffer.
(let ((face (intern-soft (thing-at-point 'symbol))))
(if (facep face)
(push face faces))))
;; Add the named faces that the `read-face-name' or `face' property uses.
(let ((faceprop (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(cond ((facep faceprop)
(push faceprop faces))
((face-list-p faceprop)
(dolist (face faceprop)
(if (facep face)
(push face faces))))))
(if multiple
(delete-dups (nreverse faces))
(car (last faces)))))