(feat): disable unnecessary org-mode startup for temp buffers (#1057)

Set `org-inhibit-startup` to `t` to reduce the amount of time taken to set up org-mode buffers. For example, this disables latex image generation, and table alignment.

Also introduces `org-roam-doctor-inhibit-startup`, which speeds up `org-roam-doctor` runs.
This commit is contained in:
Tim Quelch
2020-08-27 15:23:38 +10:00
committed by GitHub
parent b8b180d60d
commit 6f0a38e64e
4 changed files with 16 additions and 3 deletions

View File

@ -59,6 +59,15 @@
(defvar org-roam-verbose)
(defvar org-roam-mode)
(defcustom org-roam-doctor-inhibit-startup t
"Inhibit `org-mode' startup when processing files with `org-doctor'.
When non-nil, images and LaTeX preview will not be generated,
tables will not be aligned, and headlines will not respect
startup visability. This significantly improves performance when
processing multiple files"
:type 'boolean
:group 'org-roam)
(cl-defstruct (org-roam-doctor-checker (:copier nil))
(name 'missing-checker-name)
(description "")
@ -294,7 +303,8 @@ If CHECKALL, run the check for all Org-roam files."
(defun org-roam-doctor-start (files checkers)
"Lint FILES using CHECKERS."
(save-window-excursion
(let ((existing-buffers (org-roam--get-roam-buffers)))
(let ((existing-buffers (org-roam--get-roam-buffers))
(org-inhibit-startup org-roam-doctor-inhibit-startup))
(dolist (f files)
(let ((buf (find-file-noselect f)))
(org-roam-doctor--check buf checkers)