forked from mirrors/org-mode
ol: Fix `org-previous-link' skipping links
* lisp/ol.el (org-next-link): Do not skip links when searching backwards. Reported-by: stardiviner <numbchild@gmail.com> <http://lists.gnu.org/r/emacs-orgmode/2019-04/msg00022.html>
This commit is contained in:
parent
ea4876869c
commit
09a1a24b73
|
@ -1308,7 +1308,7 @@ is non-nil, move backward."
|
||||||
(catch :found
|
(catch :found
|
||||||
(while (funcall search-fun org-link-any-re nil t)
|
(while (funcall search-fun org-link-any-re nil t)
|
||||||
(let ((context (save-excursion
|
(let ((context (save-excursion
|
||||||
(forward-char -1)
|
(unless search-backward (forward-char -1))
|
||||||
(org-element-context))))
|
(org-element-context))))
|
||||||
(pcase (org-element-lineage context '(link) t)
|
(pcase (org-element-lineage context '(link) t)
|
||||||
(`nil nil)
|
(`nil nil)
|
||||||
|
|
|
@ -352,6 +352,11 @@
|
||||||
(org-test-with-temp-text "[[link1]]\n[[link2<point>]]"
|
(org-test-with-temp-text "[[link1]]\n[[link2<point>]]"
|
||||||
(org-previous-link)
|
(org-previous-link)
|
||||||
(buffer-substring (point) (line-end-position)))))
|
(buffer-substring (point) (line-end-position)))))
|
||||||
|
(should
|
||||||
|
(equal "[[link1]]"
|
||||||
|
(org-test-with-temp-text "line\n[[link1]]\n[[link2<point>]]"
|
||||||
|
(org-previous-link)
|
||||||
|
(buffer-substring (point) (line-end-position)))))
|
||||||
;; Ignore fake links.
|
;; Ignore fake links.
|
||||||
(should
|
(should
|
||||||
(equal "[[truelink]]"
|
(equal "[[truelink]]"
|
||||||
|
|
Loading…
Reference in New Issue