diff options
| author | Eli Zaretskii | 2019-09-25 11:42:35 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2019-09-25 11:42:35 +0300 |
| commit | 165890a70a256ce5c5f5953ac35239c295234684 (patch) | |
| tree | b4be99218eb4945a29e892408492974789642b53 | |
| parent | 213bcaf1bf365d0d40639754b8123f9d770b08e8 (diff) | |
| download | emacs-165890a70a256ce5c5f5953ac35239c295234684.tar.gz emacs-165890a70a256ce5c5f5953ac35239c295234684.zip | |
Improve documentation of 'text-property-search-forward'
* lisp/emacs-lisp/text-property-search.el (text-property-search-forward)
(text-property-search-backward): Improve doc strings. (Bug#37488)
| -rw-r--r-- | lisp/emacs-lisp/text-property-search.el | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/lisp/emacs-lisp/text-property-search.el b/lisp/emacs-lisp/text-property-search.el index 5329c967e35..24d11be21dc 100644 --- a/lisp/emacs-lisp/text-property-search.el +++ b/lisp/emacs-lisp/text-property-search.el | |||
| @@ -31,28 +31,26 @@ | |||
| 31 | 31 | ||
| 32 | (defun text-property-search-forward (property &optional value predicate | 32 | (defun text-property-search-forward (property &optional value predicate |
| 33 | not-current) | 33 | not-current) |
| 34 | "Search for the next region that has text property PROPERTY set to VALUE. | 34 | "Search for the next region of text whose PROPERTY matches VALUE. |
| 35 | If not found, the return value is nil. If found, point will be | 35 | |
| 36 | placed at the end of the region and an object describing the | 36 | If not found, return nil. If found, move point to end of the region and |
| 37 | match is returned. | 37 | return a `prop-match' object describing the match. To access the details |
| 38 | 38 | of the match, use `prop-match-beginning' and `prop-match-end' for the | |
| 39 | PREDICATE is called with two values. The first is the VALUE | 39 | buffer positions that limit the region, and `prop-match-value' for the |
| 40 | parameter. The second is the value of PROPERTY. This predicate | 40 | value of PROPERTY in the region. |
| 41 | should return non-nil if there is a match. | 41 | |
| 42 | 42 | PREDICATE is used to decide whether a value of PROPERTY should be | |
| 43 | Some convenience values for PREDICATE can also be used. `t' | 43 | considered as matching VALUE. |
| 44 | means the same as `equal'. `nil' means almost the same as \"not | 44 | If PREDICATE is t, that means a value must `equal' VALUE to be |
| 45 | equal\", but will also end the match if the value of PROPERTY | 45 | considered a match. |
| 46 | changes. See the manual for extensive examples. | 46 | If PREDICATE is nil, a value will match if it is NOT `equal' to |
| 47 | 47 | VALUE, and will also end the match if the value of PROPERTY changes. | |
| 48 | If NOT-CURRENT, if the match is under point, it will not be | 48 | If PREDICATE is a function, it will be called with two arguments: |
| 49 | returned, but instead the next instance is returned, if any. | 49 | VALUE and the value of PROPERTY. The function should return |
| 50 | 50 | non-nil if these two values should be considered a match. | |
| 51 | The return value (if a match is made) is a `prop-match' | 51 | |
| 52 | structure. The accessors available are | 52 | If NOT-CURRENT is non-nil, the function will search for the first |
| 53 | `prop-match-beginning'/`prop-match-end' (the region in the buffer | 53 | region with matching value of PROPERTY that doesn't include point." |
| 54 | that's matching), and `prop-match-value' (the value of PROPERTY | ||
| 55 | at the start of the region)." | ||
| 56 | (interactive | 54 | (interactive |
| 57 | (list | 55 | (list |
| 58 | (let ((string (completing-read "Search for property: " obarray))) | 56 | (let ((string (completing-read "Search for property: " obarray))) |
| @@ -122,8 +120,9 @@ at the start of the region)." | |||
| 122 | 120 | ||
| 123 | (defun text-property-search-backward (property &optional value predicate | 121 | (defun text-property-search-backward (property &optional value predicate |
| 124 | not-current) | 122 | not-current) |
| 125 | "Search for the previous region that has text property PROPERTY set to VALUE. | 123 | "Search for the previous region of text whose PROPERTY matches VALUE. |
| 126 | See `text-property-search-forward' for further documentation." | 124 | |
| 125 | Like `text-property-search-forward', which see, but searches backward." | ||
| 127 | (interactive | 126 | (interactive |
| 128 | (list | 127 | (list |
| 129 | (let ((string (completing-read "Search for property: " obarray))) | 128 | (let ((string (completing-read "Search for property: " obarray))) |