summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorAndrew Whatson <whatson@gmail.com>2020-06-19 16:44:54 +1000
committerjao <jao@gnu.org>2020-07-06 20:12:33 +0000
commit210068c7d552c35b958f0647bbb5bfa3cb8e4726 (patch)
treee18c84d872a9e5492d1cf10033c01e804e420656 /elisp
parentdaa8236bd7b133af8fce5b11e8f3da1c6776a6c1 (diff)
downloadgeiser-210068c7d552c35b958f0647bbb5bfa3cb8e4726.tar.gz
geiser-210068c7d552c35b958f0647bbb5bfa3cb8e4726.tar.bz2
Refactor to make repl/impl proj argument optional
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-repl.el30
1 files changed, 16 insertions, 14 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 82ee628..17dfd45 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -283,24 +283,27 @@ module command as a string")
(and geiser-repl--repl
(get-buffer-process geiser-repl--repl)))
-(defun geiser-repl--repl/impl (impl proj &optional repls)
- (catch 'repl
- (dolist (repl (or repls geiser-repl--repls))
- (when (buffer-live-p repl)
- (with-current-buffer repl
- (when (and (eq geiser-impl--implementation impl)
- (eq geiser-repl--project proj))
- (throw 'repl repl)))))))
+(defun geiser-repl--repl/impl (impl &optional proj repls)
+ (let ((proj (or proj
+ geiser-repl--project
+ (geiser-repl--current-project)))
+ (repls (or repls
+ geiser-repl--repls)))
+ (catch 'repl
+ (dolist (repl repls)
+ (when (buffer-live-p repl)
+ (with-current-buffer repl
+ (when (and (eq geiser-impl--implementation impl)
+ (eq geiser-repl--project proj))
+ (throw 'repl repl))))))))
(defun geiser-repl--set-up-repl (impl)
(or (and (not impl) geiser-repl--repl)
(setq geiser-repl--repl
(let ((impl (or impl
geiser-impl--implementation
- (geiser-impl--guess)))
- (proj (or geiser-repl--project
- (geiser-repl--current-project))))
- (when impl (geiser-repl--repl/impl impl proj))))))
+ (geiser-impl--guess))))
+ (when impl (geiser-repl--repl/impl impl))))))
(defun geiser-repl--active-impls ()
(let ((act))
@@ -951,12 +954,11 @@ 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))
- (proj (geiser-repl--current-project))
(in-repl (eq major-mode 'geiser-repl-mode))
(in-live-repl (and in-repl (get-buffer-process (current-buffer))))
(repl (unless ask
(if impl
- (geiser-repl--repl/impl impl proj)
+ (geiser-repl--repl/impl impl)
(or geiser-repl--repl (car geiser-repl--repls))))))
(cond (in-live-repl
(when (and (not (eq repl buffer))