From f5e2b467f14a2980dbe1a862ce0b27e768b2e980 Mon Sep 17 00:00:00 2001 From: Ethan Leba Date: Thu, 26 Oct 2023 17:50:21 -0700 Subject: [PATCH] tweak(evil): disable mode if load grammar fails --- evil-tree-edit.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/evil-tree-edit.el b/evil-tree-edit.el index 862a81c..76c1f42 100644 --- a/evil-tree-edit.el +++ b/evil-tree-edit.el @@ -560,7 +560,11 @@ This is so that the current node will be properly highlighted in explorer mode." :lighter " TE" (cond (evil-tree-edit-mode - (tree-edit-load-grammar-for-major-mode) + (condition-case err + (tree-edit-load-grammar-for-major-mode) + (error + (evil-tree-edit-mode -1) + (signal (car err) (cdr err)))) (evil-tree-edit-set-state-bindings major-mode) ;; HACK: Above mode binding won't come into effect until the state is changed. (evil-normal-state)