From 2ca38a52dea984c88056c40500fc39c51268b07f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 12 Jun 2016 19:39:01 +0200 Subject: 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. --- elisp/geiser-repl.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'elisp/geiser-repl.el') 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: -- cgit v1.2.3