aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--org-link-edit.el6
-rw-r--r--test-org-link-edit.el16
2 files changed, 19 insertions, 3 deletions
diff --git a/org-link-edit.el b/org-link-edit.el
index 3df5a0f..180e289 100644
--- a/org-link-edit.el
+++ b/org-link-edit.el
@@ -166,9 +166,9 @@ words."
(user-error "Not enough words before the link"))
(point)))
(let ((slurped (buffer-substring-no-properties (point) beg)))
- (when (= (length desc) 0)
- (setq slurped (progn (string-match "\\(.*\\w\\)\\W*$" slurped)
- (match-string 1 slurped))))
+ (when (and (= (length desc) 0)
+ (string-match "\\(.*\\w\\)\\W*$" slurped))
+ (setq slurped (match-string 1 slurped)))
(setq slurped (replace-regexp-in-string "\n" " " slurped))
(setq desc (concat slurped desc)
beg (- beg (length slurped)))
diff --git a/test-org-link-edit.el b/test-org-link-edit.el
index 7c2a914..b778dbd 100644
--- a/test-org-link-edit.el
+++ b/test-org-link-edit.el
@@ -97,6 +97,14 @@ otherwise place the point at the beginning of the inserted text."
website is"
(org-link-edit-forward-slurp-word 1)
(buffer-string))))
+ ;; Slurp word that has no whitespace.
+ (should
+ (string=
+ "\[\[http://orgmode.org/\]\[website\]\]"
+ (org-test-with-temp-text
+ "\[\[http://orgmode.org/\]\]website"
+ (org-link-edit-forward-slurp-word 1)
+ (buffer-string))))
;; Slurp beyond the number of present words.
(should-error
(org-test-with-temp-text
@@ -156,6 +164,14 @@ website is"
<point>\[\[http://orgmode.org/\]\[Org's website\]\]"
(org-link-edit-backward-slurp-word 1)
(buffer-string))))
+ ;; Slurp word that has no whitespace.
+ (should
+ (string=
+ "Here \[\[http://orgmode.org/\]\[is\]\] Org's website"
+ (org-test-with-temp-text
+ "Here is<point>\[\[http://orgmode.org/\]\] Org's website"
+ (org-link-edit-backward-slurp-word 1)
+ (buffer-string))))
;; Slurp beyond the number of present words.
(should-error
(org-test-with-temp-text