Configure denote with directory and journal function

This commit is contained in:
Tobias Ostner 2023-06-13 09:43:23 +02:00
parent c4651cde45
commit a9f3383bbd

View file

@ -116,7 +116,23 @@
(use-package denote (use-package denote
:config :config
(setq denote-directory (expand-file-name "~/TobCloud/org/notes"))) (setq denote-directory (expand-file-name "~/TobCloud/org/notes"))
(defun to/denote-journal()
"Create an entry tagged 'journal' with the data as its title.
If a journal for the current day exists, visit it. If multiple
entries exist, prompt with completion for a choice between them.
Else create a new file."
(interactive)
(let* ((today (format-time-string "%A %e %B %Y"))
(string (denote-sluggify today))
(files (denote-directory-files-matching-regexp string)))
(cond
((> (length files) 1)
(find-file (completing-read "Select file: " files nil :require-match)))
(files
(find-file (car files)))
(t
(denote today '("journal")))))))
(use-package dired (use-package dired
:ensure nil :ensure nil