aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-05-05 19:38:34 -0400
committerKyle Meyer <kyle@kyleam.com>2017-05-05 19:38:34 -0400
commit57f3a6110d7386cb71b01b8251aa7d3b11be5b8e (patch)
tree8af12fe8c597444cda33583f350711f10160f621
parente0be9b9a015fcce95c9cf8df40dcf78ce307ee81 (diff)
downloadorg-link-edit-57f3a6110d7386cb71b01b8251aa7d3b11be5b8e.tar.gz
transport-next-link: Fix error on whitespace
When point is on whitespace, there are no description bounds because there is no text to use for the description. Avoid a type error in this case by navigating to the initial location of point rather than the left description bound.
-rw-r--r--org-link-edit.el2
-rw-r--r--test-org-link-edit.el7
2 files changed, 8 insertions, 1 deletions
diff --git a/org-link-edit.el b/org-link-edit.el
index 6fa105a..636d191 100644
--- a/org-link-edit.el
+++ b/org-link-edit.el
@@ -373,7 +373,7 @@ END."
(progn (goto-char pt)
(org-link-edit--on-link-p)))
(user-error "Cannot transport next link with point on a link"))
- (goto-char (car desc-bounds))
+ (goto-char (or (car desc-bounds) pt))
(cl-multiple-value-bind (link-beg link-end link desc)
(org-link-edit--next-link-data previous)
(unless (or (not desc-bounds) (= (length desc) 0))
diff --git a/test-org-link-edit.el b/test-org-link-edit.el
index 9f8a3bd..a5fecef 100644
--- a/test-org-link-edit.el
+++ b/test-org-link-edit.el
@@ -545,6 +545,13 @@ website"
(org-link-edit-transport-next-link
'previous (point) (point-max))
(buffer-string))))
+ ;; Transport next link with point on whitespace.
+ (should
+ (string= "Here is\[\[http://orgmode.org/\]\] Org's website "
+ (org-test-with-temp-text
+ "Here is<point> Org's website http://orgmode.org/"
+ (org-link-edit-transport-next-link)
+ (buffer-string))))
;; Fail if point is on a link.
(should-error
(org-test-with-temp-text