um-next takes a list of tags, as a comma separated string

remove the '+' logic from the shell component.

i'm getting closer to just moving all logic into elisp. but that awk is so great.
This commit is contained in:
bth 2024-08-30 17:21:38 -07:00
commit 124954420a
3 changed files with 31 additions and 16 deletions

View file

@ -201,19 +201,24 @@ NOTE: this searches in the current project root only.
;; shell integration
;;;###autoload
(defun um-next (next-file &optional tag skip-header)
(defun um-next (next-file &optional tags skip-header)
"Takes the next-file generated by the shell script and opens it.
With the optional tag generated by the script.
And the option not to insert the um-journal-header.
Optional TAGS string may contain more than one tag separated by a comma.
The SKIP-HEADER option says not to insert the um-journal-header at all,
in which case TAGS is also ignored.
"
(find-file next-file)
(find-file next-file)
(unless skip-header
(um-journal-header)
(if tag
(progn (forward-line -1)
(insert (format "+ %s\n" tag))
(forward-line))))
(um-journal-header)
(if tags
(progn (forward-line -1)
(dolist (tag (split-string tags ","))
(insert (format "+ %s\n"
(if (equal "+" tag)
(cadr (split-string next-file "\\."))
tag))))
(forward-line))))
(message (format "creating %s" next-file))
)