summaryrefslogtreecommitdiff
path: root/elisp/geiser-repl.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-07-25 23:43:50 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-07-25 23:43:50 +0200
commit235543503d09a52a513054ed75ac2506b7ce87bf (patch)
treee75df482f8154e55a1a418fc38b5ccd4c2c09364 /elisp/geiser-repl.el
parent941d65165b3bce917d3bff9952e582800ccf2981 (diff)
downloadgeiser-guile-235543503d09a52a513054ed75ac2506b7ce87bf.tar.gz
geiser-guile-235543503d09a52a513054ed75ac2506b7ce87bf.tar.bz2
C-c z as a to and fro jump, plus documentation.
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r--elisp/geiser-repl.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 694f21b..d969164 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -222,7 +222,10 @@ you at that point.")
"Start Geiser for scheme implementation: "))))
(geiser-repl--start-repl impl))
-(defun switch-to-geiser (&optional ask impl)
+(make-variable-buffer-local
+ (defvar geiser-repl--last-scm-buffer nil))
+
+(defun switch-to-geiser (&optional ask impl buffer)
"Switch to running Geiser REPL.
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."
@@ -233,12 +236,17 @@ If no REPL is running, execute `run-geiser' to start a fresh one."
(car geiser-repl--repls))))
((and (not ask) impl (geiser-repl--repl/impl impl)))))
(pop-up-windows geiser-repl-window-allow-split))
- (if repl
- (pop-to-buffer repl)
- (run-geiser (or impl
- (and (not ask)
- (geiser-repl--only-impl-p))
- (geiser-repl--read-impl "Switch to scheme REPL: "))))))
+ (cond ((and (eq (current-buffer) repl)
+ (buffer-live-p geiser-repl--last-scm-buffer))
+ (pop-to-buffer geiser-repl--last-scm-buffer))
+ (repl (pop-to-buffer repl))
+ (t (run-geiser (or impl
+ (and (not ask)
+ (geiser-repl--only-impl-p))
+ (geiser-repl--read-impl
+ "Switch to scheme REPL: ")))))
+ (when (and buffer (eq major-mode 'geiser-repl-mode))
+ (setq geiser-repl--last-scm-buffer buffer))))
(defalias 'geiser 'switch-to-geiser)
@@ -254,7 +262,7 @@ If no REPL is running, execute `run-geiser' to start a fresh one."
"Function taking a module designator and returning a REPL enter
module command as a string")
-(defun switch-to-geiser-module (&optional module)
+(defun switch-to-geiser-module (&optional module buffer)
"Switch to running Geiser REPL and try to enter a given module."
(interactive)
(let* ((module (or module
@@ -262,7 +270,7 @@ module command as a string")
(cmd (and module
(geiser-repl--enter-cmd geiser-impl--implementation
module))))
- (switch-to-geiser)
+ (switch-to-geiser nil nil buffer)
(geiser-repl--send cmd)))
(geiser-impl--define-caller geiser-repl--import-cmd import-command (module)