summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Nguyen <james@jojojames.com>2018-01-13 10:58:42 -0800
committerJames Nguyen <james@jojojames.com>2018-01-13 11:06:38 -0800
commit68a214064c08a2a164a520a249a164b1ee7d69db (patch)
treeac1b062caa800ba4bd6a3b02192e3ad44900a04e
parent4a89fa75d38176a73303e930a38dada0e4c28bb8 (diff)
Indium: Add debugger interaction keys
-rw-r--r--evil-collection-indium.el31
-rw-r--r--readme.org11
2 files changed, 42 insertions, 0 deletions
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