Skip to content

Commit

Permalink
New debugging tool-bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Malabarba committed Jul 8, 2015
1 parent 9559b3e commit ae040e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* [#1188](https://github.com/clojure-emacs/cider/pull/1188): New debugging tool-bar.
* [#1187](https://github.com/clojure-emacs/cider/pull/1187): The list of keys displayed by the debugger can be configured with `cider-debug-prompt`.
* [#1187](https://github.com/clojure-emacs/cider/pull/1187): While debugging, there is a menu on the menu-bar listing available commands.
* [#1184](https://github.com/clojure-emacs/cider/pull/1184): When the user kills the repl buffer, CIDER will offer to kill the nrepl buffer and process too. Also, when the client (repl) process dies, the server (nrepl) process is killed too.
Expand Down
19 changes: 16 additions & 3 deletions cider-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ of `cider-interactive-eval' in debug sessions."
key)
t))

(defvar cider--debug-mode-tool-bar-map
(let ((tool-bar-map (make-sparse-keymap)))
(tool-bar-add-item "right-arrow" #'cider-debug-mode-send-reply :next :label "Next step")
(tool-bar-add-item "next-node" #'cider-debug-mode-send-reply :continue :label "Continue non-stop")
(tool-bar-add-item "jump-to" #'cider-debug-mode-send-reply :out :label "Out of sexp")
(tool-bar-add-item "exit" #'cider-debug-mode-send-reply :quit :label "Quit")
tool-bar-map))

(defvar cider--debug-mode-map)

(define-minor-mode cider--debug-mode
Expand All @@ -295,6 +303,7 @@ In order to work properly, this mode must be activated by
(if cider--debug-mode
(if cider--debug-mode-response
(nrepl-dbind-response cider--debug-mode-response (input-type)
(setq-local tool-bar-map cider--debug-mode-tool-bar-map)
(unless (consp input-type)
(error "debug-mode activated on a message not asking for commands: %s" cider--debug-mode-response))
;; Integrate with eval commands.
Expand Down Expand Up @@ -324,6 +333,7 @@ In order to work properly, this mode must be activated by
(when (or (not buffer) (buffer-live-p buffer))
(with-current-buffer (or buffer (current-buffer))
(unless cider--debug-mode
(kill-local-variable 'tool-bar-map)
(remove-overlays nil nil 'cider-type 'debug-result)
(remove-overlays nil nil 'cider-type 'debug-code)
(setq cider--debug-prompt-overlay nil)
Expand All @@ -339,6 +349,7 @@ In order to work properly, this mode must be activated by
`("CIDER DEBUGGER"
["Next step" (cider-debug-mode-send-reply ":next") :keys "n"]
["Continue non-stop" (cider-debug-mode-send-reply ":continue") :keys "c"]
["Move out of sexp" (cider-debug-mode-send-reply ":out") :keys "o"]
["Quit" (cider-debug-mode-send-reply ":quit") :keys "q"]
"--"
["Evaluate in current scope" (cider-debug-mode-send-reply ":eval") :keys "e"]
Expand All @@ -359,9 +370,11 @@ In order to work properly, this mode must be activated by
"Reply to the message that started current bufer's debugging session.
COMMAND is sent as the input option. KEY can be provided to reply to a
specific message."
(interactive (list (cdr (assq last-command-event
cider--debug-mode-commands-alist))
nil))
(interactive (list
(if (symbolp last-command-event)
(symbol-name last-command-event)
(cdr (assq last-command-event cider--debug-mode-commands-alist)))
nil))
(nrepl-send-request
(list "op" "debug-input" "input" (or command ":quit")
"key" (or key (nrepl-dict-get cider--debug-mode-response "key")))
Expand Down

0 comments on commit ae040e6

Please sign in to comment.