diff options
Diffstat (limited to 'modules/org-roam-config.el')
| -rw-r--r-- | modules/org-roam-config.el | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/modules/org-roam-config.el b/modules/org-roam-config.el index 218f37d68..eca867df8 100644 --- a/modules/org-roam-config.el +++ b/modules/org-roam-config.el @@ -27,6 +27,29 @@ (require 'user-constants) +;; Declared special so the `let'-binding in `cj/org-roam-copy-todo-to-today' +;; compiles as a dynamic bind, not a dead lexical local -- otherwise the custom +;; capture template never reaches org-roam-dailies (the foreign-special-var trap). +(defvar org-roam-dailies-capture-templates) + +;; External variables, declared special so byte-compilation doesn't treat them +;; as free references/assignments. Owned by org and org-roam-dailies. +(defvar org-agenda-timegrid-use-ampm) +(defvar org-roam-dailies-map) +(defvar org-last-state) + +;; External functions, declared so the byte-compiler knows they're defined at +;; runtime by their respective packages. +(declare-function org-roam-node-tags "org-roam") +(declare-function org-roam-node-file "org-roam") +(declare-function org-roam-node-list "org-roam") +(declare-function org-roam-dailies--capture "org-roam-dailies") +(declare-function org-capture-get "org-capture") +(declare-function org-at-heading-p "org") +(declare-function org-heading-components "org") +(declare-function org-copy-subtree "org") +(declare-function org-cut-subtree "org") + ;; ---------------------------------- Org Roam --------------------------------- (defconst cj/--org-roam-dailies-head @@ -71,8 +94,6 @@ FILETAGS and TITLE must sit on separate lines so Org parses the :bind (("C-c n l" . org-roam-buffer-toggle) ("C-c n f" . org-roam-node-find) ("C-c n p" . cj/org-roam-find-node-project) - ("C-c n r" . cj/org-roam-find-node-recipe) - ("C-c n t" . cj/org-roam-find-node-topic) ("C-c n i" . org-roam-node-insert) ("C-c n w" . cj/org-roam-find-node-webclip) :map org-mode-map @@ -81,8 +102,10 @@ FILETAGS and TITLE must sit on separate lines so Org parses the ;; org-log-done is set once in org-config.el (cj/org-todo-settings). (setq org-agenda-timegrid-use-ampm t) - (when (fboundp 'cj/build-org-refile-targets) - (cj/build-org-refile-targets)) + ;; Don't build the org-refile targets cache here. org-refile-config.el + ;; already schedules it on a 5s idle timer; doing it in org-roam's :config + ;; (which fires at the 1s :defer) ran the same multi-file scan synchronously + ;; at first idle and froze Emacs on a cold cache. The 5s timer covers it. ;; remove/disable if performance slows ;; (setq org-element-use-cache nil) ;; disables caching org files @@ -186,6 +209,11 @@ created in that subdirectory of `org-roam-directory'." (interactive) (cj/org-roam-find-node "Recipe" "r" (concat roam-dir "templates/recipe.org") "recipes/")) +;; Bound after their defuns (not in the use-package :bind) so the byte-compiler +;; doesn't see both a :bind autoload and the real defun as two definitions. +(keymap-global-set "C-c n r" #'cj/org-roam-find-node-recipe) +(keymap-global-set "C-c n t" #'cj/org-roam-find-node-topic) + ;; ---------------------- Org Capture After Finalize Hook ---------------------- (defun cj/org-roam-add-node-to-agenda-files-finalize-hook () |
