From 14a6d7710c0c910e931ca4c6bfe970d6b969e9ea Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 26 Jun 2018 01:16:01 +0200 Subject: [PATCH] Prevent recursive require errors with evil-org Caused when evil-org-set-key-theme is called too early (somehow). Also makes evil-org-key-theme customizable, so it doesn't override a user's changes to it. Reported by @majorgreys --- modules/lang/org/config.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index da6baa883..894cc623e 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -25,7 +25,7 @@ :when (featurep! :feature evil +everywhere) :hook (org-mode . evil-org-mode) :init - (setq evil-org-key-theme '(navigation insert textobjects)) + (defvar evil-org-key-theme '(navigation insert textobjects)) (add-hook 'org-load-hook #'+org|setup-evil) (add-hook 'evil-org-mode-hook #'evil-normalize-keymaps) :config @@ -266,8 +266,10 @@ between the two." [remap doom/backward-to-bol-or-indent] #'org-beginning-of-line [remap doom/forward-to-last-non-comment-or-eol] #'org-end-of-line)) -(defun +org|setup-evil (&rest _) - (require 'evil-org) +(defun +org|setup-evil (&rest args) + ;; In case this hook is used in an advice on `evil-org-set-key-theme', this + ;; prevents recursive requires. + (unless args (require 'evil-org)) ;; By default, TAB cycles the visibility of all children under the current ;; tree between three states. I want to toggle the tree between two states, ;; without affecting its children.