From eae1cdc00ce5a1fb7ca862b6b0eb5a8897e31d62 Mon Sep 17 00:00:00 2001 From: Jethro Kuan Date: Mon, 3 May 2021 11:41:20 +0800 Subject: [PATCH] try other buffer-file-coding-system fix Previous fix resulted in slow DB caching, suspect that it doesn't apply the perf enhancements. Maybe this works? cc @nobiot --- org-roam-macs.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org-roam-macs.el b/org-roam-macs.el index 840deb8..f62db2c 100644 --- a/org-roam-macs.el +++ b/org-roam-macs.el @@ -47,16 +47,21 @@ If FILE is nil, execute BODY in the current buffer. Kills the buffer if KEEP-BUF-P is nil, and FILE is not yet visited." (declare (indent 2) (debug t)) - `(let* ((org-inhibit-startup t) - new-buf + `(let* (new-buf (buf (or (and (not ,file) (current-buffer)) ;If FILE is nil, use current buffer (find-buffer-visiting ,file) ; If FILE is already visited, find buffer (progn (setq new-buf t) - (delay-mode-hooks (find-file-noselect ,file))))) ; Else, visit FILE and return buffer + (find-file-noselect ,file nil t)))) ; Else, visit FILE and return buffer res) (with-current-buffer buf + (kill-local-variable 'buffer-file-coding-system) + (kill-local-variable 'find-file-literally) + (unless (equal major-mode 'org-mode) + (delay-mode-hooks + (let ((org-inhibit-startup t)) + (org-mode)))) (setq res (progn ,@body)) (unless (and new-buf (not ,keep-buf-p)) (save-buffer)))