emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7cc6e1d: Add shortdoc for text properties


From: Stefan Kangas
Subject: master 7cc6e1d: Add shortdoc for text properties
Date: Tue, 28 Sep 2021 14:46:36 -0400 (EDT)

branch: master
commit 7cc6e1dda73946c9a75e50a198bdbce0cd19cd4d
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Add shortdoc for text properties
    
    * lisp/emacs-lisp/shortdoc.el (text-properties): New shortdoc.
    
    e for your changes. Lines starting
---
 lisp/emacs-lisp/shortdoc.el | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index d4838ff..51c822d 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]