2019-09-18 13:29:06 +09:00
|
|
|
;;; lang/org/contrib/journal.el -*- lexical-binding: t; -*-
|
2019-09-18 13:30:26 +09:00
|
|
|
;;;###if (featurep! +journal)
|
2019-09-18 13:29:06 +09:00
|
|
|
|
2020-04-12 03:41:42 -04:00
|
|
|
(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
|
|
|
|
;; duplicate and hard-coded `auto-mode-alist' entries, so we suppress it
|
|
|
|
;; and use the more generalize regexp (above).
|
|
|
|
(advice-add #'org-journal-update-auto-mode-alist :override #'ignore)
|
|
|
|
;; HACK `org-journal-dir' has is surrounded by setter and `auto-mode-alist'
|
|
|
|
;; magic which makes its needlessly difficult to create an "overrideable"
|
|
|
|
;; default for Doom users, so we set this to an empty string (anything
|
|
|
|
;; else will throw an error) so we can detect it being changed later.
|
|
|
|
(setq org-journal-dir ""
|
|
|
|
org-journal-cache-file (concat doom-cache-dir "org-journal"))
|
|
|
|
:config
|
|
|
|
(when (string-empty-p org-journal-dir)
|
|
|
|
(setq! org-journal-dir (expand-file-name "journal/" org-directory)))
|
|
|
|
(setq org-journal-find-file #'find-file)
|
2019-10-31 23:09:43 -04:00
|
|
|
|
2020-01-18 20:34:37 -05:00
|
|
|
(map! (:map org-journal-mode-map
|
|
|
|
:n "]f" #'org-journal-open-next-entry
|
|
|
|
:n "[f" #'org-journal-open-previous-entry
|
|
|
|
:n "C-n" #'org-journal-open-next-entry
|
|
|
|
:n "C-p" #'org-journal-open-previous-entry)
|
2019-10-31 23:09:43 -04:00
|
|
|
(:map org-journal-search-mode-map
|
2020-01-18 20:34:37 -05:00
|
|
|
"C-n" #'org-journal-search-next
|
|
|
|
"C-p" #'org-journal-search-previous)
|
|
|
|
:localleader
|
2019-10-31 23:09:43 -04:00
|
|
|
(:map org-journal-mode-map
|
2020-01-18 20:34:37 -05:00
|
|
|
"c" #'org-journal-new-entry
|
|
|
|
"d" #'org-journal-new-date-entry
|
2019-10-31 23:09:43 -04:00
|
|
|
"n" #'org-journal-open-next-entry
|
2020-01-18 20:34:37 -05:00
|
|
|
"p" #'org-journal-open-previous-entry
|
|
|
|
(:prefix "s"
|
|
|
|
"s" #'org-journal-search
|
|
|
|
"f" #'org-journal-search-forever
|
|
|
|
"F" #'org-journal-search-future
|
|
|
|
"w" #'org-journal-search-calendar-week
|
|
|
|
"m" #'org-journal-search-calendar-month
|
|
|
|
"y" #'org-journal-search-calendar-year))
|
|
|
|
(:map org-journal-search-mode-map
|
|
|
|
"n" #'org-journal-search-next
|
|
|
|
"p" #'org-journal-search-prev)))
|