Agreed - think of the thousands of hours that could have been (and now will be) saved with this! So cool...<div><br clear="all">Chad DePue<br><a href="http://inakanetworks.com" target="_blank">inakanetworks.com</a> - development consulting | skype cdepue | @chaddepue<div>
+1 206.866.5707 <br></div><br>
<br><br><div class="gmail_quote">On Tue, Nov 22, 2011 at 10:32 AM, Joe Armstrong <span dir="ltr"><<a href="mailto:erlang@gmail.com">erlang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Hip hip horray - "for he's jolly good fellow, ....</div><div><br></div><div>Anything that saves my fingers is good.</div><div><br></div>This is very nice - this is one of those small improvements that never gets done, only<div>
now it has been. I don't know how many times I've restarted the shell and cut and paste </div><div>commands from the old shell ... </div><div><br></div><div>Works like a charm - now all we need is "search history backwards for regexp with tab completion -</div>
<div>and dwim mode". I'm a terrible typist so dwimming my inputs would be fantastic.</div><div><br></div><div>Cheers</div><div><br></div><font color="#888888"><div>/Joe</div></font><div> <br><br><div class="gmail_quote">
<div><div></div><div class="h5">On Mon, Nov 21, 2011 at 7:23 PM, Fred Hebert <span dir="ltr"><<a href="mailto:mononcqc@gmail.com" target="_blank">mononcqc@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5"><div>Hi everyone,<br></div><div><br></div><div>last week I was on a bus after work and decided to keep on going with a small project started at the EUC hackathon -- adding shell history to the Erlang shell.</div>
<div><br></div>
<div>I'm presenting the result of the quick hack: <a href="https://github.com/ferd/erlang-history" target="_blank">https://github.com/ferd/erlang-history</a></div><div><br></div><div>It works by storing the lines entered beforehand in a DETS database in your home directory (configurable). When you start a VM instance, it loads up the old history and puts it into the shell so that the up and down arrows let you use older function calls. It doesn't support things like h() and v(N), given these have all kinds of weird quirks related to storing ephemeral data on disk and loading them back after the fact (ports, refs). I also do not support ctrl-r history search, only because that can be implemented independently from the history bit.</div>
<div><br></div><div>It does support multiple nodes, should work fine without conflicts and at worse will mix in the history between different shell jobs of a single node.</div><div><br></div><div>Options include:</div><div>
<br></div><div>- hist - true | false: enables or disables shell history. Default value is true</div><div>- hist_file - string(): gives the path to where the history should be saved. By default, the file sits in your home directory as .erlang-history.$NODENAME. The node name will always be appended to the file name as a way to manage conflicts and names.</div>
<div>- hist_size - 1..N: how many input lines the shell should remember. By default, the value is set to 500.</div><div>- hist_drop - ["some", "string", ...]: lines you do not want to be saved in the history. As an example, setting hist_drop to ["q().","init:stop().","halt()."] will avoid saving most manual ways of shutting down a shell. By default, no terms are dropped.</div>
<div><br></div><div>The options are all for the kernel application, so using the 'erl -kernel hist_size 120' form or using -config files works. </div><div><br></div><div>DETS repairs work in case of a corrupted DB, although you can just drop the file altogether if it takes too long. I don't drop files because I didn't want to assume anyone did really want their history gone. I figure creating a copy could have been fine, but I didn't think that far ahead.</div>
<div><br></div><div>There are no tests at this point. I might add a few of them later in the future, testing the logic of a few private functions, but because the group.erl file had no tests (that I could quickly find) in OTP, I decided to go on with the simplest thing that can work. For this reason (no tests), I assume this is *not* something worth submitting as patch to the Erlang/OTP team.</div>
<div><br></div><div>Let me know what you think of it. Also: enjoy!</div><div><br></div><div>Have a nice day, everyone.</div>
<br></div></div><div class="im">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>