Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rlwrap for repl #617

Open
ju-sh opened this issue Mar 7, 2023 · 4 comments
Open

rlwrap for repl #617

ju-sh opened this issue Mar 7, 2023 · 4 comments

Comments

@ju-sh
Copy link

ju-sh commented Mar 7, 2023

Hi.

Is there a way to have the idris-repl use rlwrap?

So that command history can be made use of?

@ju-sh
Copy link
Author

ju-sh commented Mar 7, 2023

Can idris-repl-mode-hook be of any help here?

@gallais
Copy link
Contributor

gallais commented Mar 7, 2023

Based on live sightings, I believe @mjustus got it to work for the REPL in emacs.

@mjustus
Copy link

mjustus commented Mar 7, 2023

idris-repl-mode keeps a history of up to 200 commands by default that can be navigated with M-p/C-up for the previous and M-n/C-down for the next entry:

idris-mode/idris-repl.el

Lines 204 to 226 in c96f45d

(defvar idris-repl-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<RET>") 'idris-repl-return)
;; (define-key map (kbd "<TAB>") ...) makes the debugger complain, and
;; suggests this method of binding instead.
(define-key map "\t" 'completion-at-point)
(define-key map (kbd "<home>") 'idris-repl-begin-of-prompt)
(define-key map (kbd "C-a") 'idris-repl-begin-of-prompt)
(define-key map (kbd "M-p") 'idris-repl-backward-history)
(define-key map (kbd "<C-up>") 'idris-repl-backward-history)
(define-key map (kbd "M-n") 'idris-repl-forward-history)
(define-key map (kbd "<C-down>") 'idris-repl-forward-history)
(define-key map (kbd "C-c M-o") 'idris-repl-clear-buffer)
(cl-loop for keyer
in '(idris-define-docs-keys
idris-define-general-keys
idris-define-active-term-keys)
do (funcall keyer map))
(substitute-key-definition 'idris-switch-to-repl
'idris-switch-to-last-idris-buffer
map)
map)
"Keymap used in Idris REPL mode.")

Size and location of the history file can be set via customize-group under idris-repl.

I don't think there's an easy way to get any of the more advanced GNU Readline features though.

@kuribas
Copy link

kuribas commented Mar 10, 2023

Isn't readline mimicking emacs? I can see some cirularity here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants