** Suggestions for temporary buffers
Fixes, performance
- Org roam mode
(defmacro org-roam-with-temp-buffer (file &rest body)
"Execute BODY within a temp buffer.
Like `with-temp-buffer', but propagates `org-roam-directory'.
If FILE, set `default-directory' to FILE's directory and insert its contents."
(declare (indent 1) (debug t))
(let ((current-org-roam-directory (make-symbol "current-org-roam-directory")))
`(let ((,current-org-roam-directory org-roam-directory))
(with-temp-buffer
(let ((org-roam-directory ,current-org-roam-directory)
;; HHHH---------------------------------------------------
(org-inhibit-startup t))
;; HHHH---------------------------------------------------
(delay-mode-hooks (org-mode))
(when ,file
(insert-file-contents ,file)
(setq-local default-directory (file-name-directory ,file)))
,@body)))))
Simple cache design
- Wrap org-mode inside delay-mode-hooks otherplace
(defun modified/org-roam-fontify-like-in-org-mode (s)
(with-temp-buffer
(insert s)
(let ((org-ref-buffer-hacked t))
;; (org-mode)
(delay-mode-hooks (org-mode))
(setq-local org-fold-core-style 'overlays)
(font-lock-ensure)
(buffer-string))))
(advice-add 'org-roam-fontify-like-in-org-mode
:override
#'modified/org-roam-fontify-like-in-org-mode)
Please consider. Thanks.