From a37e87dd2162ddb8b368cd269aac1f857c9e185e Mon Sep 17 00:00:00 2001 From: James Nguyen Date: Thu, 11 Jan 2018 19:31:04 -0800 Subject: [PATCH] Gate indium debugger bindings with defcustom --- evil-collection-indium.el | 29 +++++++++++++++-------------- evil-collection.el | 13 +++++++++++++ readme.org | 1 + 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/evil-collection-indium.el b/evil-collection-indium.el index fc0159b..87d7ed8 100644 --- a/evil-collection-indium.el +++ b/evil-collection-indium.el @@ -27,25 +27,26 @@ ;;; Bindings for `indium'. ;;; Code: -(require 'evil) +(require 'evil-collection) (require 'indium nil t) (defun evil-collection-indium-setup () "Set up `evil' bindings for `indium'." - (evil-define-key 'normal indium-debugger-mode-map - "n" 'indium-debugger-step-over - "i" 'indium-debugger-step-into - "o" 'indium-debugger-step-out - "c" 'indium-debugger-resume - "L" 'indium-debugger-locals - "s" 'indium-debugger-stack-frames - "q" 'indium-debugger-resume - "H" 'indium-debugger-here - "e" 'indium-debugger-evaluate - ">" 'indium-debugger-next-frame - "<" 'indium-debugger-previous-frame) + (when evil-collection-setup-debugger-keys + (evil-define-key 'normal indium-debugger-mode-map + "n" 'indium-debugger-step-over + "i" 'indium-debugger-step-into + "o" 'indium-debugger-step-out + "c" 'indium-debugger-resume + "L" 'indium-debugger-locals + "s" 'indium-debugger-stack-frames + "q" 'indium-debugger-resume + "H" 'indium-debugger-here + "e" 'indium-debugger-evaluate + ">" 'indium-debugger-next-frame + "<" 'indium-debugger-previous-frame) - (add-hook 'indium-debugger-mode-hook #'evil-normalize-keymaps) + (add-hook 'indium-debugger-mode-hook #'evil-normalize-keymaps)) (evil-define-key 'normal indium-inspector-mode-map (kbd "RET") 'indium-follow-link diff --git a/evil-collection.el b/evil-collection.el index d258912..3d68c79 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -56,6 +56,19 @@ or evil-collection.") :type 'boolean :group 'evil-collection) +(defcustom evil-collection-setup-debugger-keys t + "Whether to bind debugger keys when debugger is active. + +Debugger in this case is dependent on mode. + +This is only relevant for debug modes that are part of another mode, + +e.g. `indium'. Modes like `edebug' or `realgud' needs to be explicitly disabled + +through removing their entry from `evil-collection-mode-list'." + :type 'boolean + :group 'evil-collection) + (defcustom evil-collection-mode-list `(ag alchemist diff --git a/readme.org b/readme.org index 1e5e2d9..64b2065 100644 --- a/readme.org +++ b/readme.org @@ -95,6 +95,7 @@ Here's another full TLDR ~use-package~ example. | evil-collection-outline-bind-tab-p | t | Enable -based bindings in Outline mode. | | evil-collection-term-sync-state-and-mode-p | t | Synchronize insert/normal state with char/line-mode in term-mode. | | evil-collection-setup-minibuffer | nil | Set up Vim style bindings in the minibuffer. | + | evil-collection-setup-debugger-keys | t | Set up debugger keys for certain modes. | ** Guidelines