commit 35f68553dc8b392f760733c438b084996fa5fa44
parent fd849e28022c03c7925fd2b4693c0497327adefc
Author: Spencer Williams <spnw@plexwave.org>
Date: Sun, 6 Jul 2025 22:04:10 -0400
Add create-as-draft feature
Diffstat:
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/lisp/seam.el b/lisp/seam.el
@@ -53,9 +53,25 @@
:type 'string)
(defcustom seam-note-types '("private" "public")
- "Seam note types."
+ "List of valid Seam note types. Each element can either be a
+string (the name of the type), or an alist. If using an alist,
+the car should be the type name, and the cdr should be a plist
+containing any number of these properties:
+
+ `:create-as-draft'
+
+ When this is non-nil, new Seam notes of this type will be
+ created as drafts. If this is missing, falls back to
+ `seam-create-as-draft'."
+ :group 'seam
+ :type '(repeat
+ (choice string
+ (alist :key-type string :value-type plist))))
+
+(defcustom seam-create-as-draft nil
+ "When non-nil, new Seam notes will be created as drafts."
:group 'seam
- :type '(repeat string))
+ :type 'boolean)
(defun seam-format-title-default (title type draft-p)
"Default Seam title formatter. Formats like this: \"TITLE (TYPE[ draft])\"."
@@ -209,9 +225,14 @@ naming. Must be a function taking two arguments: TITLE and TYPE."
(seam-validate-note-type type)
(seam-ensure-note-subdirectories-exist)
(let* ((slug (seam-slugify title))
+ (draft-p
+ (if-let ((result (plist-member (cdr (assoc type (mapcar #'ensure-list seam-note-types)))
+ :create-as-draft)))
+ (cadr result)
+ seam-create-as-draft))
(file (file-name-concat seam-note-directory
type
- (concat slug ".org"))))
+ (concat (when draft-p "-") slug ".org"))))
(when (string= "" slug)
(error "Cannot create a note with an empty slug"))
(seam--check-conflict slug)