alf/ob-restclient.el@0ebfc7c5eb -> alf/ob-restclient.el@bfbc4d8e8a awth13/org-appear@148aa12490 -> awth13/org-appear@a1aa8496f2 bastibe/org-journal@6c3a2fdb6c -> bastibe/org-journal@9757996ca0 emacs-straight/org@b83ae59347 -> emacs-straight/org@888aaa97c0 hakimel/reveal.js@b18f12d964 -> hakimel/reveal.js@abe9abbed7 hniksic/emacs-htmlize@4920510589 -> hniksic/emacs-htmlize@dd27bc3f26 kaushalmodi/ox-hugo@290b5d6b65 -> kaushalmodi/ox-hugo@1b8f2627cd oer/org-re-reveal@cf000894f6 -> oer/org-re-reveal@ee712db657 org-roam/org-roam@028c95a011 -> org-roam/org-roam@946a879a4a Close #5338
71 lines
3.2 KiB
EmacsLisp
71 lines
3.2 KiB
EmacsLisp
;;; lang/org/contrib/journal.el -*- lexical-binding: t; -*-
|
|
;;;###if (featurep! +journal)
|
|
|
|
(use-package! org-journal
|
|
:defer t
|
|
:init
|
|
;; HACK `org-journal' adds a `magic-mode-alist' entry for detecting journal
|
|
;; files, but this causes us lazy loaders a big problem: an unacceptable
|
|
;; 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.
|
|
(add-to-list 'magic-mode-alist '(+org-journal-p . org-journal-mode))
|
|
|
|
(defun +org-journal-p ()
|
|
"Wrapper around `org-journal-is-journal' to lazy load `org-journal'."
|
|
(when-let (buffer-file-name (buffer-file-name (buffer-base-buffer)))
|
|
(if (or (featurep 'org-journal)
|
|
(and (file-in-directory-p
|
|
buffer-file-name (expand-file-name org-journal-dir org-directory))
|
|
(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
|
|
;; org-journal is loaded).
|
|
(setq org-journal-dir "journal/"
|
|
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.
|
|
;; Open in "other window" is less predictable, and can replace a window
|
|
;; we wanted to keep visible.
|
|
org-journal-find-file #'find-file)
|
|
|
|
;; Setup carryover to include all configured TODO states. We cannot carry over
|
|
;; [ ] keywords because `org-journal-carryover-items's syntax cannot correctly
|
|
;; interpret it as anything other than a date.
|
|
(setq org-journal-carryover-items "TODO=\"TODO\"|TODO=\"PROJ\"|TODO=\"STRT\"|TODO=\"WAIT\"|TODO=\"HOLD\"")
|
|
|
|
(set-company-backend! 'org-journal-mode 'company-capf 'company-dabbrev)
|
|
|
|
(map! (:map org-journal-mode-map
|
|
:n "]f" #'org-journal-next-entry
|
|
:n "[f" #'org-journal-previous-entry
|
|
:n "C-n" #'org-journal-next-entry
|
|
:n "C-p" #'org-journal-previous-entry)
|
|
(:map org-journal-search-mode-map
|
|
"C-n" #'org-journal-search-next
|
|
"C-p" #'org-journal-search-previous)
|
|
:localleader
|
|
(:map org-journal-mode-map
|
|
"c" #'org-journal-new-entry
|
|
"d" #'org-journal-new-date-entry
|
|
"n" #'org-journal-next-entry
|
|
"p" #'org-journal-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)))
|