aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/seam-test.el19
-rw-r--r--lisp/seam.el2
2 files changed, 20 insertions, 1 deletions
diff --git a/lisp/seam-test.el b/lisp/seam-test.el
index 47d4fbb..13c52c6 100644
--- a/lisp/seam-test.el
+++ b/lisp/seam-test.el
@@ -506,6 +506,25 @@ it."
(seam-test-list-files))
(kill-buffer)))))))
+(ert-deftest seam-test-follow-link-new-draft ()
+ "Test that following a link to an nonexistent draft note creates
+and opens that note."
+ (should
+ (equal
+ '("-bar" ("private/-bar.org" "private/foo.org"))
+ (seam-test-with-notes ()
+ ((foo "foo"))
+ (with-current-buffer foo
+ (seam-test-add-contents foo "[[seam:-bar]]")
+ (goto-char 1)
+ (org-next-link)
+ (org-open-at-point)
+ (unwind-protect
+ (list
+ (buffer-name)
+ (seam-test-list-files))
+ (kill-buffer)))))))
+
(ert-deftest seam-test-escape-title ()
(should
(equal
diff --git a/lisp/seam.el b/lisp/seam.el
index 2330b97..eb3037e 100644
--- a/lisp/seam.el
+++ b/lisp/seam.el
@@ -115,7 +115,7 @@ naming. Must be a function taking two arguments: TITLE and TYPE."
(org-mark-ring-push)
(if-let ((file (seam-lookup-slug path)))
(find-file file)
- (seam-create-note path nil t))
+ (seam-create-note path nil t (seam-draft-p path)))
(seam-set-buffer-name))
(defvar seam-note-file-regexp "\\`[^.].+\\.org\\'")