Browse Source

Move interaction commands to indium-interaction

workspaces
Nicolas Petton 2 years ago
parent
commit
438c1a1da9
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
2 changed files with 35 additions and 35 deletions
  1. +0
    -35
      indium-backend.el
  2. +35
    -0
      indium-interaction.el

+ 0
- 35
indium-backend.el View File

@ -59,41 +59,6 @@
BACKEND should be a symbol."
(add-to-list 'indium-backends backend))
(defun indium-quit ()
"Close the current connection and kill its REPL buffer if any.
If a process is attached to the connection, kill it as well.
When called interactively, prompt for a confirmation first."
(interactive)
(unless-indium-connected
(user-error "No active connection to close"))
(when (or (not (called-interactively-p 'interactive))
(y-or-n-p (format "Do you really want to close the connection to %s ? "
(indium-current-connection-url))))
(let ((process (indium-current-connection-process)))
(indium-backend-close-connection (indium-current-connection-backend))
(indium-backend-cleanup-buffers)
(when (and process
(memq (process-status process)
'(run stop open listen)))
(kill-process process))
(setq indium-current-connection nil))))
(defun indium-maybe-quit ()
"Close the current connection.
Unlike `indium-quit', do not signal an error when there is no
active connection."
(when-indium-connected
(call-interactively #'indium-quit)))
(defun indium-reconnect ()
"Try to re-establish a connection.
The new connection is based on the current (usually closed) one."
(interactive)
(unless-indium-connected
(user-error "No Indium connection to reconnect to"))
(indium-backend-reconnect (indium-current-connection-backend)))
(declare-function indium-repl-get-buffer "indium-repl.el")
(declare-function indium-debugger-unset-current-buffer "indium-debugger.el")


+ 35
- 0
indium-interaction.el View File

@ -44,6 +44,41 @@
(defvar indium-update-script-source-hook nil
"Hook run when script source is updated.")
(defun indium-quit ()
"Close the current connection and kill its REPL buffer if any.
If a process is attached to the connection, kill it as well.
When called interactively, prompt for a confirmation first."
(interactive)
(unless-indium-connected
(user-error "No active connection to close"))
(when (or (not (called-interactively-p 'interactive))
(y-or-n-p (format "Do you really want to close the connection to %s ? "
(indium-current-connection-url))))
(let ((process (indium-current-connection-process)))
(indium-backend-close-connection (indium-current-connection-backend))
(indium-backend-cleanup-buffers)
(when (and process
(memq (process-status process)
'(run stop open listen)))
(kill-process process))
(setq indium-current-connection nil))))
(defun indium-maybe-quit ()
"Close the current connection.
Unlike `indium-quit', do not signal an error when there is no
active connection."
(when-indium-connected
(call-interactively #'indium-quit)))
(defun indium-reconnect ()
"Try to re-establish a connection.
The new connection is based on the current (usually closed) one."
(interactive)
(unless-indium-connected
(user-error "No Indium connection to reconnect to"))
(indium-backend-reconnect (indium-current-connection-backend)))
(defun indium-eval (string &optional callback)
"Evaluate STRING on the current backend.


Loading…
Cancel
Save