From f227c036720bcdbe311ac2a884cd940b163d1363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6tzel?= Date: Mon, 9 Aug 2021 09:13:45 +0200 Subject: [PATCH] (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 --- org-roam-db.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org-roam-db.el b/org-roam-db.el index 305b0d9..9099c18 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -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) "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 (with-temp-buffer (set-buffer-multibyte nil)