summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-09-28 20:45:08 +0200
committerStefan Kangas <stefan@marxist.se>2021-09-28 20:45:08 +0200
commit7cc6e1dda73946c9a75e50a198bdbce0cd19cd4d (patch)
tree4ca3548af4e1a6abd269ccf1f0636705f72d8e5f /lisp/emacs-lisp
parentccb35fb8fb9de5f069fd0103f24e3048d716febc (diff)
downloademacs-7cc6e1dda73946c9a75e50a198bdbce0cd19cd4d.tar.gz
emacs-7cc6e1dda73946c9a75e50a198bdbce0cd19cd4d.tar.bz2
emacs-7cc6e1dda73946c9a75e50a198bdbce0cd19cd4d.zip
Add shortdoc for text properties
* lisp/emacs-lisp/shortdoc.el (text-properties): New shortdoc. e for your changes. Lines starting
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/shortdoc.el43
1 files changed, 43 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index d4838ff0f85..51c822d21e2 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -1158,6 +1158,49 @@ There can be any number of :example/:result elements."
(sqrt
:eval (sqrt -1)))
+(define-short-documentation-group text-properties
+ "Examining Text Properties"
+ (get-text-property
+ :eval (get-text-property 0 'foo (propertize "x" 'foo t)))
+ (get-char-property
+ :eval (get-char-property 0 'foo (propertize "x" 'foo t)))
+ (get-pos-property
+ :eval (get-pos-property 0 'foo (propertize "x" 'foo t)))
+ (get-char-property-and-overlay
+ :eval (get-char-property-and-overlay 0 'foo (propertize "x" 'foo t)))
+ (text-properties-at
+ :eval (text-properties-at (point)))
+ "Changing Text Properties"
+ (put-text-property
+ :eval (let ((s "abc")) (put-text-property 0 1 'foo t s) s)
+ :no-eval (put-text-property (point) (1+ (point)) 'face 'error))
+ (add-text-properties
+ :no-eval (add-text-properties (point) (1+ (point)) '(face error)))
+ (remove-text-properties
+ :no-eval (remove-text-properties (point) (1+ (point)) '(face nil)))
+ (remove-list-of-text-properties
+ :no-eval (remove-list-of-text-properties (point) (1+ (point)) '(face font-lock-face)))
+ (set-text-properties
+ :no-eval (set-text-properties (point) (1+ (point)) '(face error)))
+ (add-face-text-property
+ (add-face-text-property START END '(:foreground "green")))
+ (propertize
+ :eval (propertize "foo" 'face 'italic 'mouse-face 'bold-italic))
+ "Searching for Text Properties"
+ (next-property-change
+ :no-eval (next-property-change (point) (current-buffer)))
+ (previous-property-change
+ :no-eval (previous-property-change (point) (current-buffer)))
+ (next-single-property-change
+ :no-eval (next-single-property-change (point) 'face (current-buffer)))
+ (previous-single-property-change
+ :no-eval (previous-single-property-change (point) 'face (current-buffer)))
+ ;; TODO: There are some more that could be added here.
+ (text-property-search-forward
+ :no-eval (text-property-search-forward 'face nil t))
+ (text-property-search-backward
+ :no-eval (text-property-search-backward 'face nil t)))
+
;;;###autoload
(defun shortdoc-display-group (group &optional function)
"Pop to a buffer with short documentation summary for functions in GROUP.