From 35f68553dc8b392f760733c438b084996fa5fa44 Mon Sep 17 00:00:00 2001 From: Spencer Williams Date: Sun, 6 Jul 2025 22:04:10 -0400 Subject: Add create-as-draft feature --- lisp/seam.el | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lisp/seam.el b/lisp/seam.el index 113d2c8..9c421c2 100644 --- 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) -- cgit v1.2.3