Extend daily note to be able to prompt for date
This commit is contained in:
parent
33c8999722
commit
ef0a072d18
@ -13,19 +13,24 @@
|
||||
(interactive)
|
||||
(switch-to-buffer "*org-scratch*")
|
||||
(org-mode))
|
||||
(defun org-find-daily-note ()
|
||||
(interactive)
|
||||
(cl-defun org-find-daily-note (date)
|
||||
"Find the daily note for DATE, creating it if necessary.
|
||||
|
||||
DATE should be in the format \"YYYY-MM-DD\". If called interactively, default to today's date. If called with\
|
||||
a prefix argument, prompt for the date."
|
||||
|
||||
(interactive (list (if current-prefix-arg
|
||||
(org-read-date nil nil nil "Date: ")
|
||||
(format-time-string "%Y-%m-%d"))))
|
||||
(let* ((filename (expand-file-name
|
||||
(format "~/org/daily/%s.org"
|
||||
(format-time-string "%Y-%m-%d"))))
|
||||
(format "~/org/daily/%s.org" date)))
|
||||
(file-exists (file-exists-p filename)))
|
||||
(find-file filename)
|
||||
(goto-char (point-min))
|
||||
(unless file-exists
|
||||
(org-id-get-create)
|
||||
(goto-char (point-max))
|
||||
(insert (format "#+title: %s daily note"
|
||||
(format-time-string "%Y-%m-%d")))
|
||||
(insert (format "#+title: %s daily note" date))
|
||||
(newline))
|
||||
(goto-char (point-max))))
|
||||
(org-babel-do-load-languages
|
||||
@ -87,7 +92,15 @@
|
||||
(leader-map "ol" #'org-store-link)
|
||||
(leader-map "od" #'org-find-daily-note)
|
||||
(normal org-mode-map "<return>" #'org-return)
|
||||
(normal org-mode-map "T" #'org-insert-todo-heading))
|
||||
(normal org-mode-map "T" #'org-insert-todo-heading)
|
||||
(org-read-date-minibuffer-local-map "C-k" (lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-week 1)))
|
||||
"C-j" (lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-week 1)))
|
||||
"C-h" (lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-day 1)))
|
||||
"C-l" (lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-day 1)))))
|
||||
|
||||
(use-package evil-org
|
||||
:after org
|
||||
|
Loading…
Reference in New Issue
Block a user