mirror of
https://github.com/org-roam/org-roam
synced 2025-09-26 16:40:56 -05:00
(bugfix): propagate org-roam-directory to temp buffers (#275)
This commit is contained in:
14
org-roam.el
14
org-roam.el
@@ -351,7 +351,7 @@ This is equivalent to removing the node from the graph."
|
|||||||
(time (current-time))
|
(time (current-time))
|
||||||
all-files all-links all-titles all-refs)
|
all-files all-links all-titles all-refs)
|
||||||
(dolist (file org-roam-files)
|
(dolist (file org-roam-files)
|
||||||
(with-temp-buffer
|
(org-roam--with-temp-buffer
|
||||||
(insert-file-contents file)
|
(insert-file-contents file)
|
||||||
(let ((contents-hash (secure-hash 'sha1 (current-buffer))))
|
(let ((contents-hash (secure-hash 'sha1 (current-buffer))))
|
||||||
(unless (string= (gethash file current-files)
|
(unless (string= (gethash file current-files)
|
||||||
@@ -436,6 +436,16 @@ https://github.com/kaushalmodi/ox-hugo/blob/a80b250987bc770600c424a10b3bca6ff728
|
|||||||
(setq ret (append ret str-list2))))
|
(setq ret (append ret str-list2))))
|
||||||
ret)))
|
ret)))
|
||||||
|
|
||||||
|
(defmacro org-roam--with-temp-buffer (&rest body)
|
||||||
|
"Call `with-temp-buffer', propagating `org-roam-directory' to
|
||||||
|
the temp buffer."
|
||||||
|
(declare (indent 0) (debug t))
|
||||||
|
(let ((current-org-roam-directory (make-symbol "current-org-roam-directory")))
|
||||||
|
`(let ((,current-org-roam-directory org-roam-directory))
|
||||||
|
(with-temp-buffer
|
||||||
|
(let ((org-roam-directory ,current-org-roam-directory))
|
||||||
|
,@body)))))
|
||||||
|
|
||||||
;;;; File functions and predicates
|
;;;; File functions and predicates
|
||||||
(defun org-roam--touch-file (path)
|
(defun org-roam--touch-file (path)
|
||||||
"Touches an empty file at PATH."
|
"Touches an empty file at PATH."
|
||||||
@@ -1130,7 +1140,7 @@ The Org-roam database titles table is read, to obtain the list of titles.
|
|||||||
The file-links table is then read to obtain all directed links, and formatted
|
The file-links table is then read to obtain all directed links, and formatted
|
||||||
into a digraph."
|
into a digraph."
|
||||||
(org-roam--db-ensure-built)
|
(org-roam--db-ensure-built)
|
||||||
(with-temp-buffer
|
(org-roam--with-temp-buffer
|
||||||
(let* ((matcher (concat "%" org-roam-graph-exclude-matcher "%"))
|
(let* ((matcher (concat "%" org-roam-graph-exclude-matcher "%"))
|
||||||
(nodes (if org-roam-graph-exclude-matcher
|
(nodes (if org-roam-graph-exclude-matcher
|
||||||
(org-roam-sql [:select [file titles]
|
(org-roam-sql [:select [file titles]
|
||||||
|
Reference in New Issue
Block a user