(fix): fix bad behaviour on malformed properties (#763)

Org-roam now skips over bad properties and throws a warning for the
given file that contains a malformed property. This allows most of the
database rebuild to complete, and for the user to fix the offending
file.

Fixes #728.
This commit is contained in:
Jethro Kuan
2020-06-06 16:48:42 +08:00
committed by GitHub
parent c61f7e20f2
commit 1756ec6441
6 changed files with 84 additions and 233 deletions

View File

@ -39,6 +39,7 @@
(defvar org-roam-directory)
(defvar org-roam-verbose)
(defvar org-roam-file-name)
(declare-function org-roam--org-roam-file-p "org-roam")
(declare-function org-roam--extract-titles "org-roam")
@ -387,8 +388,7 @@ If FORCE, force a rebuild of the cache from scratch."
(let* ((attr (file-attributes file))
(atime (file-attribute-access-time attr))
(mtime (file-attribute-modification-time attr)))
(org-roam--with-temp-buffer
(insert-file-contents file)
(org-roam--with-temp-buffer file
(let ((contents-hash (secure-hash 'sha1 (current-buffer))))
(unless (string= (gethash file current-files)
contents-hash)