Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
meedstrom committed Sep 1, 2024
1 parent f816660 commit 529f23d
Showing 1 changed file with 43 additions and 22 deletions.
65 changes: 43 additions & 22 deletions org-node-fakeroam.el
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@
(require 'emacsql)
(message "Install org-roam to use org-node-fakeroam library"))

;; Satisfy compiler
(declare-function emacsql-with-transaction "emacsql")
(declare-function org-roam-buffer--redisplay-h "org-roam-mode")
(declare-function org-roam-buffer--setup-redisplay-h "org-roam-mode")
(declare-function org-roam-buffer--visibility "org-roam-mode")
(declare-function org-roam-buffer-persistent-redisplay "org-roam-mode")
(declare-function org-roam-buffer-refresh "org-roam-mode")
(declare-function org-roam-dailies--capture "org-roam-dailies")
(declare-function org-roam-db "org-roam-db")
(declare-function org-roam-db--close "org-roam-db")
(declare-function org-roam-db-query "org-roam-db")
(declare-function org-roam-fontify-like-in-org-mode "org-roam-utils")
(declare-function org-roam-node-insert-section "org-roam-mode")
(declare-function org-roam-preview-get-contents "org-roam-mode")
(defvar org-roam-buffer)
(defvar org-roam-dailies-directory)
(defvar org-roam-db-autosync-mode)
(defvar org-roam-db-location)
(defvar org-roam-directory)

;; TODO: Remove after most users have switched to the Melpa recipes
(defun org-node-fakeroam--check-compile ()
"Compile all fakeroam functions if not compiled.
Expand Down Expand Up @@ -494,6 +514,29 @@ For argument FILE, see that function."

;;;; Series-related

(defvar org-node-fakeroam-dir nil
"Cached value of `org-roam-directory' transformed for org-node.
This path should be directly comparable to the paths saved in
org-node objects, which lets you skip using `file-truename' to
compare paths.
See also `org-node-fakeroam-daily-dir'.")

(defvar org-node-fakeroam-daily-dir nil
"Cached value for Roam's dailies dir transformed for org-node.
This path should be directly comparable to the paths saved in
org-node objects, which lets you skip using `file-truename' to
compare paths.
Rationale: The original `org-roam-dailies-directory' was a
relative path, which incurred verbosity penalties in all code
that used it (plus practically a major performance penalty since
`expand-file-name' was often used instead of `file-name-concat').
Even more verbosity is added on top for org-node, which needs to
process the path through `org-node-abbrev-file-names'. Thus
this variable provides an easy shorthand.")

;; TODO: Somehow make `org-node-new-via-roam-capture' able to do this?
;;;###autoload
(defun org-node-fakeroam-daily-create (ymd series-key &optional goto keys)
Expand Down Expand Up @@ -523,28 +566,6 @@ GOTO and KEYS are like in `org-roam-dailies--capture'."
(declare (obsolete nil "2024-08-21"))
(org-node-fakeroam-daily-create sortstr "d" t))

(defvar org-node-fakeroam-dir nil
"Cached value of `org-roam-directory' transformed for org-node.
This path should be directly comparable to the paths saved in
org-node objects, which lets you skip using `file-truename' to
compare paths.
See also `org-node-fakeroam-daily-dir'.")

(defvar org-node-fakeroam-daily-dir nil
"Cached value for Roam's dailies dir transformed for org-node.
This path should be directly comparable to the paths saved in
org-node objects, which lets you skip using `file-truename' to
compare paths.
Rationale: The original `org-roam-dailies-directory' was a
relative path, which incurred verbosity penalties in all code
that used it (plus practically a major performance penalty since
`expand-file-name' was often used instead of `file-name-concat').
Even more verbosity is added on top for org-node, which needs to
process the path through `org-node-abbrev-file-names'. Thus
this variable provides an easy shorthand.")

(defun org-node-fakeroam--cache-roam-dirs ()
"Cache some variables.
Expand Down

0 comments on commit 529f23d

Please sign in to comment.