(feat): add org-roam-enable-headline-linking (#1030)

When disabled, Org-roam will not attempt to cache headlines, and will not create IDs.

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
Charl P. Botha 2020-08-13 05:18:06 +02:00 committed by GitHub
parent 11aac39a1b
commit 2081e1268a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View file

@ -39,6 +39,7 @@
(require 'org-roam-macs)
(defvar org-roam-directory)
(defvar org-roam-enable-headline-linking)
(defvar org-roam-verbose)
(defvar org-roam-file-name)
@ -472,7 +473,8 @@ connections, nil is returned."
(org-roam-db--update-tags)
(org-roam-db--update-titles)
(org-roam-db--update-refs)
(org-roam-db--update-headlines)
(when org-roam-enable-headline-linking
(org-roam-db--update-headlines))
(org-roam-db--update-links)))
(org-roam-buffer--update-maybe :redisplay t)))))
@ -511,9 +513,10 @@ If FORCE, force a rebuild of the cache from scratch."
:values $v1]
(vector file contents-hash (list :atime atime :mtime mtime)))
(setq file-count (1+ file-count))
(when org-roam-enable-headline-linking
(when-let ((headlines (org-roam--extract-headlines file)))
(when (org-roam-db--insert-headlines headlines)
(setq headline-count (1+ headline-count)))))
(setq headline-count (1+ headline-count))))))
(file-error
(setq org-roam-files (remove file org-roam-files))
(org-roam-db--clear-file file)

View file

@ -244,6 +244,11 @@ space-delimited strings.
(symbol)))
:group 'org-roam)
(defcustom org-roam-enable-headline-linking t
"Enable linking to headlines, which includes automatic :ID: creation and scanning of :ID:s for org-roam database."
:type 'boolean
:group 'org-roam)
(defcustom org-roam-verbose t
"Echo messages that are not errors."
:type 'boolean
@ -1589,7 +1594,8 @@ M-x info for more information at Org-roam > Installation > Post-Installation Tas
(advice-add 'rename-file :after #'org-roam--rename-file-advice)
(advice-add 'delete-file :before #'org-roam--delete-file-advice)
(when (fboundp 'org-link-set-parameters)
(org-link-set-parameters "file" :face 'org-roam--file-link-face :store #'org-roam-store-link)
(when org-roam-enable-headline-linking
(org-link-set-parameters "file" :face 'org-roam--file-link-face :store #'org-roam-store-link))
(org-link-set-parameters "id" :face 'org-roam--id-link-face))
(org-roam-db-build-cache))
(t