summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2016-06-12 19:39:01 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2016-06-12 19:39:01 +0200
commit2ca38a52dea984c88056c40500fc39c51268b07f (patch)
tree31b37d9c73a6ba6a57e888d3f9bce605b7cf7352 /elisp
parent0a3d6ca624332470f406e579f3ed5912169273ea (diff)
downloadgeiser-guile-2ca38a52dea984c88056c40500fc39c51268b07f.tar.gz
geiser-guile-2ca38a52dea984c88056c40500fc39c51268b07f.tar.bz2
New commands geiser-repl-{previous,next}-prompt
When using a prompt regexp, comint's version of these commands misbehave (they try to reuse forward-paragraph, and that's not quite it), so we're implemeting our own here in a very straightforward way. We also bind the usual C-c C-p and C-c C-n to them. It only remains to b seen whether advising the original ones is worth the trouble.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-repl.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index efdcfc3..d79f503 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -718,6 +718,8 @@ buffer."
"Previous input matching current")
("Next matching input" "\M-n" comint-next-matching-input-from-input
"Next input matching current")
+ ("Previous prompt" "\C-c\C-p" geiser-repl-previous-prompt)
+ ("Next prompt" "\C-c\C-n" geiser-repl-next-prompt)
("Previous input" "\C-c\M-p" comint-previous-input)
("Next input" "\C-c\M-n" comint-next-input)
--
@@ -851,6 +853,20 @@ With a prefix argument, force exit by killing the scheme process."
(when (stringp cmd) (geiser-repl--send cmd))
(comint-kill-subjob)))))
+(defun geiser-repl-next-prompt (n)
+ (interactive "p")
+ (when (> n 0)
+ (end-of-line)
+ (re-search-forward comint-prompt-regexp nil 'go n)))
+
+(defun geiser-repl-previous-prompt (n)
+ (interactive "p")
+ (when (> n 0)
+ (previous-line)
+ (end-of-line)
+ (when (re-search-backward comint-prompt-regexp nil 'go n)
+ (goto-char (match-end 0)))))
+
;;; Unload: