(fix): autoloaded commands load org-roam-mode (#712)

Users should not have to explicitly enable the minor mode before using
autoloaded commands.
This commit is contained in:
N V
2020-05-28 00:25:19 -04:00
committed by GitHub
parent 2e220f511e
commit 5ee38f2d89
6 changed files with 21 additions and 0 deletions

View File

@ -45,7 +45,9 @@
"Capture templates for daily notes in Org-roam.")
;; Declarations
(defvar org-roam-mode)
(declare-function org-roam--file-path-from-id "org-roam")
(declare-function org-roam-mode "org-roam")
(defun org-roam-dailies--file-for-time (time)
"Create and find file for TIME."
@ -59,18 +61,21 @@
(defun org-roam-dailies-today ()
"Create and find the daily note for today."
(interactive)
(unless org-roam-mode (org-roam-mode))
(org-roam-dailies--file-for-time (current-time)))
(defun org-roam-dailies-tomorrow (n)
"Create and find the daily note for tomorrow.
With numeric argument N, use N days in the future."
(interactive "p")
(unless org-roam-mode (org-roam-mode))
(org-roam-dailies--file-for-time (time-add (* n 86400) (current-time))))
(defun org-roam-dailies-yesterday (n)
"Create and find the file for yesterday.
With numeric argument N, use N days in the past."
(interactive "p")
(unless org-roam-mode (org-roam-mode))
(org-roam-dailies-tomorrow (- n)))
(defun org-roam-dailies-date ()