[erlang-patches] Shell History to Erlang

Fred Hebert <>
Thu Feb 9 04:24:14 CET 2012

Hi there,

I have made a hack named erlang-history available a few months ago and
since then I've kept maintaining it in a public repo on github (

It's basically just a small modification to kernel/group.erl and a new
module called group_history.erl. I've used DETS tables at this point in
time, as it was (at first) easy to store stuff that way. The old requests
are injected into the shell when it first starts up (and it does so for all
instances of the shell on a given node). They're saved to disk when the
command stack/zipper gets saved after a new line.

The other reason for using DETS, aside for not reinventing stuff, is that
it's part of stdlib, which is always there anyway. The only downside is
that repairing DETS tables uses the group leader and when the group.erl
group leader calls it, it can get stuck in a loop -- that's accounted for
in the code.

Anyway, it also supports a full set of options, added to 'kernel': number
of lines saved, where to save them, terms to drop from history, etc.
They're described in the README of the repository.

To make a long story short, I'm wondering if this kind of material has any
chance of making it into OTP proper, rather than just being a hack/patch to
apply after installing Erlang.

I know there are no tests, but then, group.erl also has no tests and it's
difficult to test it all (which I figure could make the OTP team reluctant
to including it). I could add tests for the group_history.erl module itself
if required though, but some features would definitely be hard to properly
test (such as the group leader stuff above).

Fred Hebert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20120208/4b45fe6d/attachment.html>

More information about the erlang-patches mailing list