diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2016-06-12 19:39:01 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2016-06-12 19:39:01 +0200 |
commit | 8dd9e3f640b52b0ef32f65a6f247fcb61eaf4c0c (patch) | |
tree | bbfc8fba977fa3661f5b235444d867133ea85961 | |
parent | e33305afaef53e296cbcf468dafec460f3661793 (diff) | |
download | geiser-8dd9e3f640b52b0ef32f65a6f247fcb61eaf4c0c.tar.gz geiser-8dd9e3f640b52b0ef32f65a6f247fcb61eaf4c0c.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.
-rw-r--r-- | elisp/geiser-repl.el | 16 |
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: |