summaryrefslogtreecommitdiff
path: root/lisp/thingatpt.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r--lisp/thingatpt.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index a7c86fb24f0..462f87d3c1a 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -74,7 +74,7 @@ question.
\"things\" include `symbol', `list', `sexp', `defun', `filename',
`existing-filename', `url', `email', `uuid', `word', `sentence',
-`whitespace', `line', and `page'.")
+`whitespace', `line', `face' and `page'.")
;; Basic movement
@@ -166,7 +166,7 @@ positions of the thing found."
THING should be a symbol specifying a type of syntactic entity.
Possibilities include `symbol', `list', `sexp', `defun',
`filename', `existing-filename', `url', `email', `uuid', `word',
-`sentence', `whitespace', `line', `number', and `page'.
+`sentence', `whitespace', `line', `number', `face' and `page'.
When the optional argument NO-PROPERTIES is non-nil,
strip text properties from the return value.
@@ -361,6 +361,15 @@ E.g.:
(put 'existing-filename 'thing-at-point 'thing-at-point-file-at-point)
+;; Faces
+
+(defun thing-at-point-face-at-point (&optional _lax _bounds)
+ "Return the name of the face at point as a symbol."
+ (when-let ((face (thing-at-point 'symbol)))
+ (and (facep face) (intern face))))
+
+(put 'face 'thing-at-point 'thing-at-point-face-at-point)
+
;; URIs
(defvar thing-at-point-beginning-of-url-regexp nil