summaryrefslogtreecommitdiff
path: root/lisp/thingatpt.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2022-08-15 02:22:59 +0300
committerDmitry Gutov <dgutov@yandex.ru>2022-08-15 02:22:59 +0300
commitee3a674c7c9e39fe7ff296ce1f9830fc45520de8 (patch)
treee8ba1e7be54314f208454e80e3d31044c913f3eb /lisp/thingatpt.el
parentfe0e53d963899a16e0dd1bbc1ba10a6b59f7989e (diff)
parent0a8e88fd83db5398d36064a7f87cff5b57da7284 (diff)
downloademacs-scratch/font_lock_large_files.tar.gz
Merge branch 'master' into scratch/font_lock_large_filesscratch/font_lock_large_files
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