diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2018-04-22 16:58:10 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2018-04-22 16:58:10 +0200 |
commit | e6edd177a93b36e969d72008b426deac51c86d9a (patch) | |
tree | 935053b5cac99b2fae3ec059d01ba503623bf43e /lisp/emacs-lisp | |
parent | 214ca3b5857c3fc9f425bb1949cfc26f8c53da56 (diff) | |
download | emacs-e6edd177a93b36e969d72008b426deac51c86d9a.tar.gz emacs-e6edd177a93b36e969d72008b426deac51c86d9a.tar.bz2 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.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/text-property-search.el | 19 |
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." (let ((string (completing-read "Search for property: " obarray))) (when (> (length string) 0) (intern string obarray))))) - ;; We're standing in the property we're looking for, so find the - ;; end. - (if (and (text-property--match-p value (get-text-property (point) property) - predicate) - (not not-immediate)) - (text-property--find-end-forward (point) property value predicate) + (cond + ;; No matches at the end of the buffer. + ((eobp) + nil) + ;; We're standing in the property we're looking for, so find the + ;; end. + ((and (text-property--match-p value (get-text-property (point) property) + predicate) + (not not-immediate)) + (text-property--find-end-forward (point) property value predicate)) + (t (let ((origin (point)) (ended nil) pos) @@ -86,7 +91,7 @@ value of PROPERTY at the start of the region." (goto-char origin) (setq ended t))))) (and (not (eq ended t)) - ended)))) + ended))))) (defun text-property--find-end-forward (start property value predicate) (let (end) |