branch: externals/org
commit 1f657935729c84ed406fa4344f6a7331802a7211
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
org-link-open-from-string: Err on invalid links
* lisp/ol.el (org-link-open-from-string): Throw an error when S is not
a full link.
Reported-by: Eyoel Yohannes <[email protected]>
Link:
https://orgmode.org/list/cagpwzjvbkt0vjuphtjyybtypwugp3vz_jp_fac3fsxenyyo...@mail.gmail.com
---
lisp/ol.el | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lisp/ol.el b/lisp/ol.el
index 4adf5f1ecc..4f29beb644 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1717,6 +1717,9 @@ Optional argument ARG is passed to `org-open-file' when S
is a
(goto-char (point-min))
(org-element-link-parser)))
(`nil (user-error "No valid link in %S" s))
+ ((and link (guard (not (equal (org-element-end link) (1+ (length s))))))
+ (user-error "Garbage after link in %S (%S)"
+ s (substring s (1- (org-element-end link)))))
(link (org-link-open link arg))))
(defun org-link-search (s &optional avoid-pos stealth new-heading-container)