mirror of
https://github.com/org-roam/org-roam
synced 2025-09-16 15:56:48 -05:00
(fix)org-roam-db--file-hash: Always compute hash of encrypted file (#1725)
When inserting the GPG decrypted org buffer to to DB, make sure that the hash of the encrypted file is stored. This prevents reparsing of GPG files over and over again when synchronizing the database with the filesystem. Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
@@ -453,6 +453,10 @@ If UPDATE-P is non-nil, first remove the file in the database."
|
|||||||
|
|
||||||
(defun org-roam-db--file-hash (&optional file-path)
|
(defun org-roam-db--file-hash (&optional file-path)
|
||||||
"Compute the hash of FILE-PATH, a file or current buffer."
|
"Compute the hash of FILE-PATH, a file or current buffer."
|
||||||
|
;; If it is a GPG encrypted file, we always want to compute the hash
|
||||||
|
;; for the GPG encrypted file (undecrypted)
|
||||||
|
(when (and (not file-path) (equal "gpg" (file-name-extension (buffer-file-name))))
|
||||||
|
(setq file-path (buffer-file-name)))
|
||||||
(if file-path
|
(if file-path
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(set-buffer-multibyte nil)
|
(set-buffer-multibyte nil)
|
||||||
|
Reference in New Issue
Block a user