[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org d9963c58dc 7/7: lisp/ol.el: Fix shadowed radio targ
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org d9963c58dc 7/7: lisp/ol.el: Fix shadowed radio targets |
Date: |
Thu, 9 Jun 2022 04:58:10 -0400 (EDT) |
branch: externals/org
commit d9963c58dcaf3fb4ebde82a5ca4a5f6c0644fdf9
Author: Rudolf Adamkovič <salutis@me.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
lisp/ol.el: Fix shadowed radio targets
* lisp/ol.el (org-update-radio-target-regexp): Sort radio targets
before building the regexp that matches them.
* testing/lisp/test-org.el: Test shadowed radio targets. The bug
occurs when two targets share the same prefix and when and the longer
target appears first.
---
lisp/ol.el | 4 ++++
testing/lisp/test-org.el | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/lisp/ol.el b/lisp/ol.el
index d4bd0e40c2..3c7a6e8c42 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -2040,6 +2040,10 @@ Also refresh fontification if needed."
(cl-pushnew (org-element-property :value obj) rtn
:test #'equal))))
rtn))))
+ (setq targets
+ (sort targets
+ (lambda (a b)
+ (> (length a) (length b)))))
(setq org-target-link-regexp
(and targets
(concat before-re
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 5f13e89a48..121f9efd59 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2915,6 +2915,18 @@ Foo Bar
(org-open-at-point)
(eq (org-element-type (org-element-context)) 'radio-target))))
+(ert-deftest test-org/open-at-point/radio-target-shadowed ()
+ "Test `org-open-at-point' on shadowed radio targets."
+ (should
+ (org-test-with-temp-text
+ "<<<target shadowed>>> <<<target>>> <point>target shadowed"
+ (org-update-radio-target-regexp)
+ (org-open-at-point)
+ (string=
+ (org-element-property :value
+ (org-element-radio-target-parser))
+ "target shadowed"))))
+
(ert-deftest test-org/open-at-point/tag ()
"Test `org-open-at-point' on tags."
(should
- [elpa] externals/org updated (c02c0d660d -> d9963c58dc), ELPA Syncer, 2022/06/09
- [elpa] externals/org 819409baab 4/7: org-get-buffer-tags: Improve performance, ELPA Syncer, 2022/06/09
- [elpa] externals/org 0e7033e0ca 6/7: org-capture: Expand sexps in template with Org mode being active, ELPA Syncer, 2022/06/09
- [elpa] externals/org d9963c58dc 7/7: lisp/ol.el: Fix shadowed radio targets,
ELPA Syncer <=
- [elpa] externals/org 96746438c0 1/7: org-element--cache-find: Do not hash section/org-data/table elements, ELPA Syncer, 2022/06/09
- [elpa] externals/org 46df681336 2/7: org.el: Improve performance of deletion commands, ELPA Syncer, 2022/06/09
- [elpa] externals/org 4487acc630 5/7: org-element-cache: Do not compare buffer positions with cache keys, ELPA Syncer, 2022/06/09
- [elpa] externals/org 93821b431c 3/7: org-element--cache-for-removal: Improve performance, ELPA Syncer, 2022/06/09