Browse Source

Repl improvements (#56)

* Improve REPL buffer switching
workspaces
TatriX 3 years ago
committed by Nicolas Petton
parent
commit
6d490b0af4
2 changed files with 13 additions and 1 deletions
  1. +6
    -1
      indium-interaction.el
  2. +7
    -0
      indium-repl.el

+ 6
- 1
indium-interaction.el View File

@ -108,11 +108,16 @@ If PRINT is non-nil, print the output into the current buffer."
(lambda (result _error)
(indium-inspector-inspect result))))))
(defvar indium-repl-switch-from-buffer nil
"The buffer from which repl was activated last time.")
(defun indium-switch-to-repl-buffer ()
"Switch to the repl buffer if any."
(interactive)
(if-let ((buf (indium-repl-get-buffer)))
(switch-to-buffer buf)
(progn
(setq indium-repl-switch-from-buffer (current-buffer))
(pop-to-buffer buf t))
(user-error "No REPL buffer open")))
(defun indium-toggle-breakpoint (arg)


+ 7
- 0
indium-repl.el View File

@ -307,6 +307,12 @@ DIRECTION is `forward' or `backard' (in the history list)."
(goto-char (point-min))
(delete-region (point) indium-repl-output-end-marker))))
(defun indium-repl-pop-buffer ()
"Switch to the buffer from which repl was opened buffer if any."
(interactive)
(when indium-repl-switch-from-buffer
(pop-to-buffer indium-repl-switch-from-buffer t)))
(defun indium-repl--handle-connection-closed ()
"Display a message when the connection is closed."
(when-let ((buf (indium-repl-get-buffer)))
@ -386,6 +392,7 @@ Evaluate CALLBACK with the completion candidates."
(define-key map (kbd "C-<return>") #'newline)
(define-key map (kbd "C-c M-i") #'indium-repl-inspect)
(define-key map (kbd "C-c C-o") #'indium-repl-clear-output)
(define-key map (kbd "C-c C-z") #'indium-repl-pop-buffer)
(define-key map (kbd "C-c C-q") #'indium-quit)
(define-key map (kbd "M-p") #'indium-repl-previous-input)
(define-key map (kbd "M-n") #'indium-repl-next-input)


Loading…
Cancel
Save