[erlang-questions] Erlang Shell History discussion (Was: Re: OTP R16A has been released)
Dan Gudmundsson
dgud@REDACTED
Thu Jan 31 09:22:31 CET 2013
That work list addresses the concerns we had with original implementation,
looks good to me for a starter.
I don't have a preference about multiple or single history files
either, right now.
/Dan
On Thu, Jan 31, 2013 at 12:41 AM, Fred Hebert <mononcqc@REDACTED> wrote:
> On 01/31, Pierre Fenoll wrote:
>> Hi Fred! and sorry to diverge this thread...
>> Why do you want a history file per erlshell? bash only uses one:
>> ~/.bash_history
>> You only need one ~/.erlang.history, don't you?
>>
>
> Because from one computer you can be using remote shells to many
> different Erlang VMs running with different names.
>
> I always figured that the history for test@REDACTED would be something
> you would like a different history from something like prod@REDACTED,
> especially considering histories disappearing over time and whatnot.
> That way, different projects or nodes get isolated histories.
>
> So far I've enjoyed it and the fact I can get a clean shell history for
> projects I haven't touched in months whereas the shell I use to test
> everything locally (nonode@REDACTED) is chuck full of unrelated garbage
> and experiments.
>
> If people tell me they don't give a crap, I'm open to consider getting
> rid of that, but there's really no complexity attached to any of this. I
> simply add a call atom_to_list(node()) when opening the table/file and
> that's it.
>
> Regards,
> Fred.
>
>> On 31 January 2013 00:07, Fred Hebert <mononcqc@REDACTED> wrote:
>>
>> > That's what it is. It searches the line stack. It's a *history-search*
>> > patch, not a general history-saving patch.
>> >
>> > I have https://github.com/ferd/erlang-history that implements a search
>> > that can be saved, but there's still work to do in it before it can be
>> > good enough for OTP:
>> >
>> > 1. it relies on DETS, and DETS seems to corrupt files from time to time
>> > either when too many shells write to it, or when it's interrupted
>> > while dumping. I want to get rid of DETS at some point for some other
>> > line utility, maybe disk_log.
>> > 2. I'll need to make it use a .erlang/ directory in $HOME rather than
>> > plenty of .erlang.$NAME files. There's a truckload of .erlang.*
>> > config files around, and one per named shell is problematic.
>> > 3. Multiple shells are implemented in an okay way, but there may be a
>> > need to correct codes when many shells write to the same file
>> > (usually multiple non-distributed shells).
>> > 4. The usual OTP cleanup and formatting is required.
>> > 5. I haven't considered the issue of multiple encodings used in the same
>> > shell history file yet.
>> > 6. I haven't asked the OTP team what they think should be done at that
>> > point, but I'd be fine forking this thread to start discussing it.
>> >
>> > Lately I haven't had the time/motivation to do that heavy lifting,
>> > but with the book and university done, I'll probably find time here and
>> > there to try and make a better implementation.
>> >
>> > In the mean time, I'll keep the repository above up to date. It's not
>> > yet ready for R16A support -- I use the compiler versions to deal with
>> > things and the new code can't be the same to make it there. It should
>> > work fine with the new ^R support feature.
>> >
>> > Shell history is a tiny bit about injecting history in a shell and is
>> > *mostly* about handling files on disk. Shell history search is pretty
>> > much handling the line stack in the shell and edlin, so that one was
>> > much simpler to deal with than history to make it part of OTP :)
>> >
>> > Regards,
>> > Fred.
>> >
>> > On 01/30, Motiejus Jakštys wrote:
>> > > On Wed, Jan 30, 2013 at 3:40 PM, Fred Hebert <mononcqc@REDACTED> wrote:
>> > > > Also:
>> > > >
>> > > > OTP-10739 Add search to Erlang shell's history. Thanks to Fred
>> > > > Herbert.
>> > >
>> > > History between sessions is not implemented (I get readline-style
>> > > ctrl-r in same session fine which is super cool)?
>> > >
>> > > /home/motiejus$ erl -config hist.config -name labas
>> > > Erlang R16A (erts-5.10) [source] [smp:2:2] [async-threads:10] [hipe]
>> > > [kernel-poll:false]
>> > >
>> > > Eshell V5.10 (abort with ^G)
>> > > (labas@REDACTED)1> application:get_all_env(kernel).
>> > > [{hist_file,"erlang-history"},
>> > > {included_applications,[]},
>> > > {error_logger,tty},
>> > > {hist_size,120},
>> > > {hist_drop,["q().","init:stop()."]}]
>> > > (labas@REDACTED)2> q().
>> > > ok
>> > > (labas@REDACTED)3> %
>> > > /home/motiejus$ ls -lA | grep erlang
>> > > -r-------- 1 motiejus motiejus 20 Rgp 23 23:00 .erlang.cookie
>> > >
>> > >
>> > > --
>> > > Motiejus Jakštys
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list