summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-07-17 18:44:49 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-07-17 18:44:49 +0200
commitba12555fda9cdd781b50e60d933aa6b8ba4464b9 (patch)
tree20705c162156080c01e342fb2b3651f88e1fe64b /lisp/emacs-lisp
parent92609aad38e5ec6175078b52bf6ecc5653a84170 (diff)
downloademacs-ba12555fda9cdd781b50e60d933aa6b8ba4464b9.tar.gz
emacs-ba12555fda9cdd781b50e60d933aa6b8ba4464b9.tar.bz2
emacs-ba12555fda9cdd781b50e60d933aa6b8ba4464b9.zip
Fix NOT-CURRENT behaviour in text-property-search-backward
* lisp/emacs-lisp/text-property-search.el (text-property-search-backward): Fix inconsistent behaviour of S-TAB in eww (and other callers that use the NOT-CURRENT behaviour) when there are adjacent elements (bug#39239).
Diffstat (limited to 'lisp/emacs-lisp')
-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)