mirror of
https://github.com/protesilaos/denote.git
synced 2026-09-15 09:46:24 -04:00
Document journal entry with check for existing daily note
This commit is contained in:
parent
8f6acf01ca
commit
cbd39ada72
27
README.org
27
README.org
|
|
@ -2138,6 +2138,33 @@ Of course, you can always set up the function so that it asks for a
|
|||
'("journal")))
|
||||
#+end_src
|
||||
|
||||
The above snippets do not check if a daily entry exists: they always
|
||||
create a new one. The idea is that one may want to write multiple
|
||||
journal entries per day. Another approach is to create a single entry
|
||||
on a given day, in which case the command must be repurposed to
|
||||
surface the existing note, if present. As with ~my-denote-journal~
|
||||
above, the title is formatted as =Tuesday 14 June 2022=.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my-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* ((string (denote-sluggify (format-time-string "%A %e %B %Y")))
|
||||
(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
|
||||
(format-time-string "%A %e %B %Y")
|
||||
'("journal"))))))
|
||||
#+end_src
|
||||
|
||||
*** Journaling with a timer
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: h:4af1f81e-e93a-43cc-b344-960032a16d42
|
||||
|
|
|
|||
Loading…
Reference in a new issue