From 36171f5b3346716ebacabc69654ab2b8cb2ec601 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 14 Jun 2018 00:08:16 +0200 Subject: [PATCH] Fix :after-call deferred packages not loading If you open emacs with a file (emacs file.txt), the file is switched to before the switch-buffer hooks are set up. However, many core packages are hooked to those switch-buffer hooks (to load when they're first triggered). They miss the boat and don't get loaded. These packages are now hooked onto after-find-file as well (and immediately), which will fire when a file is opened, before or after initialization. Fixes #680 --- core/core-editor.el | 10 +++++----- core/core-ui.el | 2 +- modules/tools/editorconfig/config.el | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index 48a84c842..bced33c52 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -79,7 +79,7 @@ fundamental-mode) for performance sake." ;; revert buffers for changed files (def-package! autorevert - :after-call doom-before-switch-buffer-hook + :after-call after-find-file :config (setq auto-revert-verbose nil) (global-auto-revert-mode +1)) @@ -97,7 +97,7 @@ fundamental-mode) for performance sake." ;; persistent point location in buffers (def-package! saveplace - :after-call doom-before-switch-buffer-hook + :after-call (after-find-file dired-initial-position-hook) :config (setq save-place-file (concat doom-cache-dir "saveplace")) (defun doom*recenter-on-load-saveplace (&rest _) @@ -110,7 +110,7 @@ fundamental-mode) for performance sake." ;; Keep track of recently opened files (def-package! recentf :defer 1 - :after-call find-file-hook + :after-call after-find-file :commands recentf-open-files :config (setq recentf-save-file (concat doom-cache-dir "recentf") @@ -133,7 +133,7 @@ fundamental-mode) for performance sake." ;; Auto-close delimiters and blocks as you type (def-package! smartparens - :after-call doom-before-switch-buffer-hook + :after-call (doom-before-switch-buffer-hook after-find-file) :commands (sp-pair sp-local-pair sp-with-modes) :config (require 'smartparens-config) @@ -153,7 +153,7 @@ fundamental-mode) for performance sake." ;; Branching undo (def-package! undo-tree - :after-call doom-before-switch-buffer-hook + :after-call (doom-before-switch-buffer-hook after-find-file) :config ;; persistent undo history is known to cause undo history corruption, which ;; can be very destructive! So disable it! diff --git a/core/core-ui.el b/core/core-ui.el index ca704ecc3..653eeb4ea 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -308,7 +308,7 @@ DEFAULT is non-nil, set the default mode-line for all buffers." ;; highlight matching delimiters (def-package! paren - :after-call doom-before-switch-buffer-hook + :after-call post-command-hook :config (setq show-paren-delay 0.1 show-paren-highlight-openparen t diff --git a/modules/tools/editorconfig/config.el b/modules/tools/editorconfig/config.el index c458b8a2e..fa0245a38 100644 --- a/modules/tools/editorconfig/config.el +++ b/modules/tools/editorconfig/config.el @@ -4,7 +4,7 @@ ;; specify their own formatting rules. (def-package! editorconfig :defer 2 - :after-call doom-before-switch-buffer + :after-call (doom-before-switch-buffer after-find-file) :config ;; Register missing indent variables (setq editorconfig-indentation-alist