From 037a20d6a621fc24576dbb4fb460b4b6cbcbc846 Mon Sep 17 00:00:00 2001 From: Spencer Williams Date: Fri, 11 Jul 2025 16:45:34 -0400 Subject: Fix creating note via link open never makes draft --- lisp/seam-test.el | 19 +++++++++++++++++++ lisp/seam.el | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lisp') 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\\'") -- cgit v1.2.3