Add function for journal entries

This commit is contained in:
Andreas Zweili 2023-11-17 08:49:15 +01:00
parent f572a02d7e
commit 1b0b90661f
1 changed files with 19 additions and 0 deletions

View File

@ -3,8 +3,27 @@
:bind
(("C-c n r" . denote-rename-file)
("C-c n p" . az-note-from-region)
("C-c n t" . az-denote-journal)
("C-c n n" . denote))
:config
(defun az-denote-journal ()
"Create an entry tagged 'journal' with the date 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"))))))
(defun az-note-from-region (beg end)
"Create note whose contents include the text between BEG and END. Prompt
for title and keywords of the new note."