Is there a way to print the history list in utop, like calling history
from bash? I haven't found any sort of history ring associated with utop-mode
in emacs either. I'm trying to use the history to hippie-expand against in the REPL.
Utop appears to respond to commands like history-prev
and history-next
(from utop.el
), but that is all I have found.
This
μ> #require "lambda-term";;
μ> LTerm_history.contents UTop.history;;
will print out your utop
history as an OCaml list of strings with the first element being the latest command you've executed (which is unsurprisingly
"LTerm_history.contents UTop.history;;"
).
Note: you can add #require "lambda-term";;
into your .ocamlinit
file to skip the first command in the above listing.
There is also ~/.utop-history
file, if you'd like to use some system utilities to access your utop
history.