From 6c59e10f0e0bba91f08fbd7b5972940aae9b0cc6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 8 Nov 2010 04:39:39 +0100 Subject: Tweakings in switch-to-geiser (multiple REPLs) --- elisp/geiser-repl.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index ee88005..b50f1d1 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -308,14 +308,21 @@ With prefix argument, ask for which one if more than one is running. If no REPL is running, execute `run-geiser' to start a fresh one." (interactive "P") (let* ((impl (or impl geiser-impl--implementation)) - (repl (cond ((and (not ask) (not impl) + (in-repl (eq major-mode 'geiser-repl-mode)) + (in-live-repl (and in-repl (get-buffer-process (current-buffer)))) + (repl (cond ((and (not ask) + (not impl) + (not in-repl) (or geiser-repl--repl (car geiser-repl--repls)))) - ((and (not ask) impl (geiser-repl--repl/impl impl))))) + ((and (not ask) + (not in-repl) + impl + (geiser-repl--repl/impl impl))))) (pop-up-windows geiser-repl-window-allow-split)) - (cond ((and (eq (current-buffer) repl) - (not (eq repl buffer)) - (buffer-live-p geiser-repl--last-scm-buffer)) - (pop-to-buffer geiser-repl--last-scm-buffer)) + (cond ((or in-live-repl + (and (eq (current-buffer) repl) (not (eq repl buffer)))) + (when (buffer-live-p geiser-repl--last-scm-buffer) + (pop-to-buffer geiser-repl--last-scm-buffer))) (repl (pop-to-buffer repl)) ((geiser-repl--remote-p) (geiser-connect impl)) (t (run-geiser impl))) -- cgit v1.2.3