summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2019-11-15 21:15:49 +0100
committerPierre Neidhardt <mail@ambrevar.xyz>2019-11-15 21:15:49 +0100
commit17d9b4a52d6b683ee852adc8ea39570fe50a378d (patch)
treef6cdad6d9a371e48c55d8ca413ceddd1f5654eb5
parentfb1495ffcab3ed4f5523d33dbb515700706d6750 (diff)
helm-comint: Add support for sly-mrepl.
-rw-r--r--helm-comint.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/helm-comint.el b/helm-comint.el
index 953d8a76..dbe61d46 100644
--- a/helm-comint.el
+++ b/helm-comint.el
@@ -47,12 +47,22 @@
:group 'helm-comint
:type 'boolean)
-(defcustom helm-comint-mode-list '(comint-mode slime-repl-mode)
+(defcustom helm-comint-mode-list '(comint-mode slime-repl-mode sly-mrepl-mode)
"Supported modes for prompt navigation.
Derived modes (e.g. Geiser's REPL) are automatically supported."
:group 'helm-comint
:type '(repeat (choice symbol)))
+(defcustom helm-comint-next-prompt-function '((sly-mrepl-mode . (lambda ()
+ (sly-mrepl-next-prompt)
+ (point))))
+ "Alist of (MODE . NEXT-PROMPT-FUNCTION) to use.
+ If the current major mode is a key in this list, the associated function will be
+ used to navigate the prompts.
+ The function must return the point after the prompt.
+ Otherwise (comint-next-prompt 1) will be used."
+ :group 'helm-comint)
+
(defcustom helm-comint-max-offset 400
"Max number of chars displayed per candidate in comint-input-ring browser.
When `t', don't truncate candidate, show all.
@@ -84,7 +94,10 @@ If BUFFER is nil, use current buffer."
(goto-char (point-min))
(let (result (count 1))
(save-mark-and-excursion
- (helm-awhile (and (not (eobp)) (comint-next-prompt 1))
+ (helm-awhile (and (not (eobp))
+ (helm-aif (alist-get major-mode helm-comint-next-prompt-function)
+ (funcall it)
+ (comint-next-prompt 1)))
(push (list (buffer-substring-no-properties
it (point-at-eol))
it (buffer-name) count)