summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/text-property-search.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-07-19 20:39:27 +0100
committerAndrea Corallo <akrl@sdf.org>2020-07-19 20:39:27 +0100
commit37e0dbc97242a69da9f02039f5635261a307659a (patch)
treec4324d0ea870f743d0adeec13e25d703e85ca2d3 /lisp/emacs-lisp/text-property-search.el
parent907618b3b51a653d111d7f5764da586fcee6da5e (diff)
parent5d2a83ea0e79308f85d06553483001b7cb2e3a14 (diff)
downloademacs-37e0dbc97242a69da9f02039f5635261a307659a.tar.gz
emacs-37e0dbc97242a69da9f02039f5635261a307659a.tar.bz2
emacs-37e0dbc97242a69da9f02039f5635261a307659a.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lisp/emacs-lisp/text-property-search.el')
-rw-r--r--lisp/emacs-lisp/text-property-search.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/text-property-search.el b/lisp/emacs-lisp/text-property-search.el
index b6e98f59a7a..61bd98d3cfe 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -137,11 +137,19 @@ and if a matching region is found, moves point to its beginning."
nil)
;; We're standing in the property we're looking for, so find the
;; end.
- ((and (text-property--match-p
- value (get-text-property (1- (point)) property)
- predicate)
- (not not-current))
- (text-property--find-end-backward (1- (point)) property value predicate))
+ ((text-property--match-p
+ value (get-text-property (1- (point)) property)
+ predicate)
+ (let ((origin (point))
+ (match (text-property--find-end-backward
+ (1- (point)) property value predicate)))
+ ;; When we want to ignore the current element, then repeat the
+ ;; search if we haven't moved out of it yet.
+ (if (and not-current
+ (equal (get-text-property (point) property)
+ (get-text-property origin property)))
+ (text-property-search-backward property value predicate)
+ match)))
(t
(let ((origin (point))
(ended nil)