Re: [PATCH] bash-4.2-release-with-unlimited-history-by-crq.diff

2012-11-20 Thread Chet Ramey
On 11/8/12 8:17 PM, cheng renquan wrote:

>> I'd rather see this done (and have adapted your previous code submission to
>> do so) in a separate program that links with the history library and can
>> operate on arbitrary history files outside of bash.  There are applications
>> besides bash that use readline, save history, and could benefit.
> 
> while the current erasedups logic is implemented in bash, I want this
> also get into bash,
> we may define another control like "erasedupsinfile" if the user set
> that we will erase dups in history file as well
> 
> HISTCONTROL=ignorespace:ignoredups:erasedups:erasedupsinfile
> 
> 
> if we contribute a binary to dedup in history file, we still need the
> logic to call it automatically, depending some similar control
> variable is set

With a separate program, you can call it whenever you want.  If you want it
to work on the entire current shell history, write a shell function akin to
this:

deep_dedup()
{
history -w /tmp/history.$$
hist_erasedups -t /tmp/history.$$
history -r /tmp/history.$$
rm -f /tmp/history.$$
}

You can have it called from PROMPT_COMMAND, for example, under whatever
conditions you like.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Hitting Esc twice auto-completes

2012-11-20 Thread smu johnson
Hi.

If you are in regular emacs mode in Bash, and you hit Esc twice, it acts as
an auto-complete, similar to just hitting tab.

I cannot find this behaviour in any of the system wide bash defaults in
/etc, or any of my own dotfiles.

An op on Freenode.#bash confirmed it happened on his too, and he uses "GNU
bash, version 4.2.39(2)-release (i686-pc-linux-gnu)".  His is far more
recent version than mine.

Thanks in advance.


-- 
smu johnson 


Re: Hitting Esc twice auto-completes

2012-11-20 Thread Clark WANG
On Wed, Nov 21, 2012 at 6:40 AM, smu johnson  wrote:

> Hi.
>
> If you are in regular emacs mode in Bash, and you hit Esc twice, it acts as
> an auto-complete, similar to just hitting tab.
>
> I cannot find this behaviour in any of the system wide bash defaults in
> /etc, or any of my own dotfiles.
>

$ bind -p | grep 'complete$'
"\C-i": complete
"\e\e": complete
$

Not sure if \e\e is on by default but if you want to disable it:

$ bind -r '\e\e'
$bind -p | grep 'complete$'
"\C-i": complete
$


>
> An op on Freenode.#bash confirmed it happened on his too, and he uses "GNU
> bash, version 4.2.39(2)-release (i686-pc-linux-gnu)".  His is far more
> recent version than mine.
>
> Thanks in advance.
>
>
> --
> smu johnson 
>


Re: Hitting Esc twice auto-completes

2012-11-20 Thread Chet Ramey
On 11/20/12 5:40 PM, smu johnson wrote:
> Hi.
> 
> If you are in regular emacs mode in Bash, and you hit Esc twice, it acts as
> an auto-complete, similar to just hitting tab.

Yes.  Readline has behaved this way for many years, since at least
bash-1.14.  It's present for compatibility with ksh (first ksh88, then
ksh93).

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/