From 68a214064c08a2a164a520a249a164b1ee7d69db Mon Sep 17 00:00:00 2001 From: James Nguyen Date: Sat, 13 Jan 2018 10:58:42 -0800 Subject: [PATCH] Indium: Add debugger interaction keys --- evil-collection-indium.el | 31 +++++++++++++++++++++++++++++++ readme.org | 11 +++++++++++ 2 files changed, 42 insertions(+) diff --git a/evil-collection-indium.el b/evil-collection-indium.el index ff2bfec..21d3ded 100644 --- a/evil-collection-indium.el +++ b/evil-collection-indium.el @@ -81,11 +81,42 @@ "gr" 'indium-update-script-source "gz" 'indium-switch-to-repl-buffer) + (when evil-collection-settings-setup-debugger-keys + (evil-define-key 'normal indium-interaction-mode-map + [left-fringe mouse-1] 'evil-collection-indium-debugger-mouse-toggle-breakpoint + [left-margin mouse-1] 'evil-collection-indium-debugger-mouse-toggle-breakpoint + [f5] 'indium-debugger-resume + [S-f5] 'indium-debugger-resume + [f9] 'evil-collection-indium-debugger-toggle-breakpoint + [f10] 'indium-debugger-step-over + [f11] 'indium-debugger-step-into + [S-f11] 'indium-debugger-step-out)) + (evil-define-key 'normal indium-repl-mode-map (kbd "gj") 'indium-repl-next-input (kbd "gk") 'indium-repl-previous-input (kbd "C-j") 'indium-repl-next-input (kbd "C-k") 'indium-repl-previous-input)) +;; FIXME: It would be better for these to go upstream. +(defun evil-collection-indium-debugger-toggle-breakpoint () + "Toggle breakpoint at point." + (interactive) + (if (and (fboundp 'indium-breakpoint-on-current-line-p) + (indium-breakpoint-on-current-line-p)) + (call-interactively #'indium-remove-breakpoint) + (call-interactively #'indium-add-breakpoint))) + +(defun evil-collection-indium-debugger-mouse-toggle-breakpoint (event) + "Toggle breakpoint at mouse EVENT click point." + (interactive "e") + (let* ((posn (event-end event)) + (pos (posn-point posn))) + (when (numberp pos) + (with-current-buffer (window-buffer (posn-window posn)) + (save-excursion + (goto-char pos) + (call-interactively #'evil-collection-indium-debugger-toggle-breakpoint)))))) + (provide 'evil-collection-indium) ;;; evil-collection-indium.el ends here diff --git a/readme.org b/readme.org index 1ab12fd..b145bae 100644 --- a/readme.org +++ b/readme.org @@ -377,6 +377,17 @@ definition". - ~J~ : Jump to debugger location - ~R~ : Restart + For debugging outside of debugger being on (e.g. setting initial breakpoints), + we use similar keys to [[https://github.com/realgud/realgud][realgud]]. + + - ~f5~ Start/Continue/Resume Execution + - ~S-f5~ Continue Execution + - ~Mouse-1~ Toggle Breakpoint + - ~f9~ Toggle Breakpoint + - ~f10~ Step Over + - ~f11~ Step Into + - ~S-f11~ Step Out + ** Modes left behind Some modes might still remain unsupported by this package. Should you be