Add function for journal entries
This commit is contained in:
parent
f572a02d7e
commit
1b0b90661f
|
@ -3,8 +3,27 @@
|
||||||
:bind
|
:bind
|
||||||
(("C-c n r" . denote-rename-file)
|
(("C-c n r" . denote-rename-file)
|
||||||
("C-c n p" . az-note-from-region)
|
("C-c n p" . az-note-from-region)
|
||||||
|
("C-c n t" . az-denote-journal)
|
||||||
("C-c n n" . denote))
|
("C-c n n" . denote))
|
||||||
:config
|
: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)
|
(defun az-note-from-region (beg end)
|
||||||
"Create note whose contents include the text between BEG and END. Prompt
|
"Create note whose contents include the text between BEG and END. Prompt
|
||||||
for title and keywords of the new note."
|
for title and keywords of the new note."
|
||||||
|
|
Loading…
Reference in New Issue