Skip to content

Commit

Permalink
Clear all existing metadata when rescanning/changing vault
Browse files Browse the repository at this point in the history
  • Loading branch information
jayemar committed Dec 4, 2024
1 parent c3c43b4 commit f95dead
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion obsidian.el
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Each link list contains the following as returned by markdown-link-at-pos:
5. title text
6. bang (nil or \"!\")")

(defvar obsidian--tags-map "Hash table with tags as keys and list of files as values.")
(defvar obsidian--tags-map nil "Hash table with tags as keys and list of files as values.")

(defvar obsidian--file-metadata nil "Hash table with file metadata (tags, aliases, links.")

Expand Down Expand Up @@ -630,7 +630,12 @@ If file is not specified, the current buffer will be used."
(interactive)
(let* ((obs-files (obsidian--find-all-files))
(file-count (length obs-files)))
;; Clear existing metadata
(setq obsidian--aliases-map (make-hash-table :test 'equal))
(setq obsidian--backlinks-alist (make-hash-table :test 'equal))
(setq obsidian--jump-list nil)
(setq obsidian-vault-cache (make-hash-table :test 'equal :size file-count))
;; Repopulate metadata
(dolist-with-progress-reporter
(i obs-files)
(format "Adding %d files to vault cache... " file-count)
Expand Down

0 comments on commit f95dead

Please sign in to comment.