summaryrefslogtreecommitdiff
path: root/org-link-edit.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-05-05 21:58:28 -0400
committerKyle Meyer <kyle@kyleam.com>2017-05-05 21:58:28 -0400
commit1f8c2002d13bd723b879aaa578bfcaf79c82787b (patch)
treea5512431b724b743b5242199584b34c7c85f76d8 /org-link-edit.el
parente0be9b9a015fcce95c9cf8df40dcf78ce307ee81 (diff)
parent5c5fef32b4690092bbc9e86a8cf6718288053596 (diff)
downloadorg-link-edit-1f8c2002d13bd723b879aaa578bfcaf79c82787b.tar.gz
Merge branch 'km/transport-whitespace'
Diffstat (limited to 'org-link-edit.el')
-rw-r--r--org-link-edit.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/org-link-edit.el b/org-link-edit.el
index 6fa105a..193f8fa 100644
--- a/org-link-edit.el
+++ b/org-link-edit.el
@@ -373,17 +373,18 @@ 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))
- (cl-multiple-value-bind (link-beg link-end link desc)
+ (goto-char (or (car desc-bounds) pt))
+ (cl-multiple-value-bind (link-beg link-end link orig-desc)
(org-link-edit--next-link-data previous)
- (unless (or (not desc-bounds) (= (length desc) 0))
+ (unless (or (not desc-bounds) (= (length orig-desc) 0))
(user-error "Link already has a description"))
(delete-region link-beg link-end)
(insert (org-make-link-string
link
- (and desc-bounds
- (delete-and-extract-region (car desc-bounds)
- (cdr desc-bounds))))))))
+ (if desc-bounds
+ (delete-and-extract-region (car desc-bounds)
+ (cdr desc-bounds))
+ orig-desc))))))
(provide 'org-link-edit)
;;; org-link-edit.el ends here