Fix org-journal-mode not loading on journal files
This commit is contained in:
parent
42084af680
commit
9ba14f0ba4
1 changed files with 18 additions and 12 deletions
|
@ -1,18 +1,24 @@
|
||||||
;;; lang/org/contrib/journal.el -*- lexical-binding: t; -*-
|
;;; lang/org/contrib/journal.el -*- lexical-binding: t; -*-
|
||||||
;;;###if (featurep! +journal)
|
;;;###if (featurep! +journal)
|
||||||
|
|
||||||
|
(use-package! org-journal
|
||||||
|
:mode ("/\\(?1:[0-9]\\{4\\}\\)\\(?2:[0-9][0-9]\\)\\(?3:[0-9][0-9]\\)\\(\\.gpg\\)?\\'"
|
||||||
|
. org-journal-mode)
|
||||||
|
:preface
|
||||||
;; HACK org-journal does some file-path magic at load time that creates
|
;; HACK org-journal does some file-path magic at load time that creates
|
||||||
;; duplicate `auto-mode-alist' entries, so we suppress it for now, so we
|
;; duplicate and hard-coded `auto-mode-alist' entries, so we suppress it
|
||||||
;; can do it properly later.
|
;; and use the more generalize regexp (above).
|
||||||
(advice-add #'org-journal-update-auto-mode-alist :override #'ignore)
|
(advice-add #'org-journal-update-auto-mode-alist :override #'ignore)
|
||||||
|
;; HACK `org-journal-dir' has is surrounded by setter and `auto-mode-alist'
|
||||||
(after! org-journal
|
;; magic which makes its needlessly difficult to create an "overrideable"
|
||||||
(setq org-journal-dir (expand-file-name "journal/" org-directory)
|
;; default for Doom users, so we set this to an empty string (anything
|
||||||
org-journal-cache-file (concat doom-cache-dir "org-journal")
|
;; else will throw an error) so we can detect it being changed later.
|
||||||
org-journal-file-pattern (org-journal-dir-and-format->regex
|
(setq org-journal-dir ""
|
||||||
org-journal-dir org-journal-file-format))
|
org-journal-cache-file (concat doom-cache-dir "org-journal"))
|
||||||
|
:config
|
||||||
(add-to-list 'auto-mode-alist (cons org-journal-file-pattern 'org-journal-mode))
|
(when (string-empty-p org-journal-dir)
|
||||||
|
(setq! org-journal-dir (expand-file-name "journal/" org-directory)))
|
||||||
|
(setq org-journal-find-file #'find-file)
|
||||||
|
|
||||||
(map! (:map org-journal-mode-map
|
(map! (:map org-journal-mode-map
|
||||||
:n "]f" #'org-journal-open-next-entry
|
:n "]f" #'org-journal-open-next-entry
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue