aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2018-04-22 16:58:10 +0200
committerLars Ingebrigtsen2018-04-22 16:58:10 +0200
commite6edd177a93b36e969d72008b426deac51c86d9a (patch)
tree935053b5cac99b2fae3ec059d01ba503623bf43e
parent214ca3b5857c3fc9f425bb1949cfc26f8c53da56 (diff)
downloademacs-e6edd177a93b36e969d72008b426deac51c86d9a.tar.gz
emacs-e6edd177a93b36e969d72008b426deac51c86d9a.zip
(text-property-search-forward): Fix search at the end
* lisp/emacs-lisp/text-property-search.el (text-property-search-forward): Fix search at the end of the buffer with no text properties.
-rw-r--r--lisp/emacs-lisp/text-property-search.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/text-property-search.el b/lisp/emacs-lisp/text-property-search.el
index cd4471a045c..ce7733acb27 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -58,12 +58,17 @@ value of PROPERTY at the start of the region."
58 (let ((string (completing-read "Search for property: " obarray))) 58 (let ((string (completing-read "Search for property: " obarray)))
59 (when (> (length string) 0) 59 (when (> (length string) 0)
60 (intern string obarray))))) 60 (intern string obarray)))))
61 ;; We're standing in the property we're looking for, so find the 61 (cond
62 ;; end. 62 ;; No matches at the end of the buffer.
63 (if (and (text-property--match-p value (get-text-property (point) property) 63 ((eobp)
64 predicate) 64 nil)
65 (not not-immediate)) 65 ;; We're standing in the property we're looking for, so find the
66 (text-property--find-end-forward (point) property value predicate) 66 ;; end.
67 ((and (text-property--match-p value (get-text-property (point) property)
68 predicate)
69 (not not-immediate))
70 (text-property--find-end-forward (point) property value predicate))
71 (t
67 (let ((origin (point)) 72 (let ((origin (point))
68 (ended nil) 73 (ended nil)
69 pos) 74 pos)
@@ -86,7 +91,7 @@ value of PROPERTY at the start of the region."
86 (goto-char origin) 91 (goto-char origin)
87 (setq ended t))))) 92 (setq ended t)))))
88 (and (not (eq ended t)) 93 (and (not (eq ended t))
89 ended)))) 94 ended)))))
90 95
91(defun text-property--find-end-forward (start property value predicate) 96(defun text-property--find-end-forward (start property value predicate)
92 (let (end) 97 (let (end)