help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emulate readline


From: Richard Riley
Subject: Re: emulate readline
Date: Thu, 07 Apr 2011 12:32:08 +0200
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux)

Le Wang <address@hidden> writes:

> On Thu, Apr 7, 2011 at 1:04 AM, fork <address@hidden> wrote:
>>
>> Is there a way to get the behavior of this (super cool)
>> readline behavior in the minibuffer?
>>
>> In my .inputrc I have this:
>>
>> "\e[A": history-search-backward
>> "\e[B": history-search-forward
>> "\eOA": history-search-backward
>> "\eOB": history-search-forward
>>
>> So in bash I can type "ps", hit the up-arrow, and get the most recent
>>  command that started with these two letters (e.g. "psql -D foobar").
>> The next time I hit up-arrow, I get "psql -U fork -D forksdb", etc.
>>
>> I would like to type M-x in emacs, then cycle through previous
>>  commands like this.
>>
>> Any help is appreciated!  Thanks!
>
> The commands you seek are (previous|next)-complete-history-element,
> which are not bound to keys by default.
>
> You also have to consider that not all mini-buffer inputs are using
> the same local key-map.  I have the following code in my
> initialization to bind M-p and M-n to these functions:
>
> (mapc (lambda (map)
>         (define-key map [(meta p)] 'previous-complete-history-element)
>         (define-key map [(meta n)] 'next-complete-history-element))
>       (list minibuffer-local-completion-map
>           minibuffer-local-isearch-map
>           minibuffer-local-map
>           minibuffer-local-must-match-map
>           minibuffer-local-ns-map))
>
> Also see the wiki page: http://www.emacswiki.org/emacs/MinibufferHistory
>

Nice, but this doesnt emulate the bash history fetch which will include all
histories containing the seed not just candidates beginning with the
seed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]