diff options
-rw-r--r-- | org-link-edit.el | 22 | ||||
-rw-r--r-- | test-org-link-edit.el | 13 |
2 files changed, 19 insertions, 16 deletions
diff --git a/org-link-edit.el b/org-link-edit.el index b670f29..f99dac3 100644 --- a/org-link-edit.el +++ b/org-link-edit.el @@ -187,11 +187,12 @@ of STRING. If the number of words in STRING is fewer than N, (with-temp-buffer (insert string) (goto-char (point-min)) - (let ((within-bound (forward-word n))) - (skip-syntax-forward "^\w") - (cons (buffer-substring 1 (point)) - (and within-bound - (buffer-substring (point) (point-max))))))) + (with-syntax-table org-mode-syntax-table + (let ((within-bound (forward-word n))) + (skip-syntax-forward "^w") + (cons (buffer-substring 1 (point)) + (and within-bound + (buffer-substring (point) (point-max)))))))) (defun org-link-edit--split-last-words (string n) "Split STRING into (other . N last words) cons cell. @@ -203,11 +204,12 @@ of STRING. If the number of words in STRING is fewer than N, (with-temp-buffer (insert string) (goto-char (point-max)) - (let ((within-bound (forward-word (- n)))) - (skip-syntax-backward "^\w") - (cons (and within-bound - (buffer-substring 1 (point))) - (buffer-substring (point) (point-max)))))) + (with-syntax-table org-mode-syntax-table + (let ((within-bound (forward-word (- n)))) + (skip-syntax-backward "^w") + (cons (and within-bound + (buffer-substring 1 (point))) + (buffer-substring (point) (point-max))))))) ;;;###autoload (defun org-link-edit-forward-barf-word (&optional n) diff --git a/test-org-link-edit.el b/test-org-link-edit.el index f7048b7..c6b3535 100644 --- a/test-org-link-edit.el +++ b/test-org-link-edit.el @@ -336,12 +336,13 @@ website is" (org-link-edit-forward-barf-word 1) (org-link-edit-forward-slurp-word 1) (buffer-string)))) - (string= "Here is \[\[http://orgmode.org/\]\[Org's\]\] website" - (org-test-with-temp-text - "Here is <point>\[\[http://orgmode.org/\]\[Org's\]\] website" - (org-link-edit-forward-slurp-word 1) - (org-link-edit-forward-barf-word 1) - (buffer-string))) + (should + (string= "Here is \[\[http://orgmode.org/\]\] Org's website" + (org-test-with-temp-text + "Here is <point>\[\[http://orgmode.org/\]\] Org's website" + (org-link-edit-forward-slurp-word 1) + (org-link-edit-forward-barf-word 1) + (buffer-string)))) (should (string= "Here is \[\[http://orgmode.org/\]\[Org's\]\] website" (org-test-with-temp-text |