summaryrefslogtreecommitdiff
path: root/lisp/thingatpt.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-08-12 15:54:55 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-08-12 15:54:55 +0200
commit829b131e5b3ad3b077be9d31215770b251341c68 (patch)
treee27f0f2ed16dc5ceec9984f40b26a239317667a1 /lisp/thingatpt.el
parentc0d761bf7f441f8ab9792351a493dc6bd5525dc1 (diff)
downloademacs-829b131e5b3ad3b077be9d31215770b251341c68.tar.gz
emacs-829b131e5b3ad3b077be9d31215770b251341c68.tar.bz2
emacs-829b131e5b3ad3b077be9d31215770b251341c68.zip
Clarify face-at-point doc string and add (thing-at-point 'face)
* lisp/faces.el (face-at-point): Say what this function does. * lisp/thingatpt.el (thing-at-point-face-at-point): Add `face' type (bug#57087). (thing-at-point-provider-alist, thing-at-point): Mention it in the doc strings.
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