Henrik Lissner 2020-06-24 18:33:05 -04:00
parent fe7ffd759d
commit 28a3d8b908
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 15 additions and 11 deletions

View file

@ -9,16 +9,16 @@
;; delay on the first file the user opens, because calling the autoloaded
;; `org-journal-is-journal' pulls all of `org' with it. So, we replace it
;; with our own, extra layer of heuristics.
(setq magic-mode-alist (assq-delete-all 'org-journal-is-journal magic-mode-alist))
(add-to-list 'magic-mode-alist '(+org-journal-p . org-journal-mode))
(defun +org-journal-p ()
(when-let (buffer-file-name (buffer-file-name (buffer-base-buffer)))
(and (file-in-directory-p
buffer-file-name (expand-file-name org-journal-dir org-directory))
(delq! '+org-journal-p magic-mode-alist 'assq)
(require 'org-journal nil t)
(org-journal-is-journal))))
(if (or (featurep 'org-journal)
(and (file-in-directory-p
buffer-file-name (expand-file-name org-journal-dir org-directory))
(delq! '+org-journal-p magic-mode-alist 'assq)
(require 'org-journal nil t)))
(org-journal-is-journal))))
;; `org-journal-dir' defaults to "~/Documents/journal/", which is an odd
;; default, so we change it to {org-directory}/journal (we expand it after
@ -27,6 +27,10 @@
org-journal-cache-file (concat doom-cache-dir "org-journal"))
:config
;; Remove the orginal journal file detector and rely on `+org-journal-p'
;; instead, to avoid loading org-journal until the last possible moment.
(setq magic-mode-alist (assq-delete-all 'org-journal-is-journal magic-mode-alist))
;; `org-journal' can't deal with symlinks, so resolve them here.
(setq org-journal-dir (expand-file-name org-journal-dir org-directory)
;; Doom opts for an "open in a popup or here" strategy as a default.