[Top][All Lists]

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

Re: emulate readline

From: Le Wang
Subject: Re: emulate readline
Date: Thu, 7 Apr 2011 09:48:53 +0800

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

Also see the wiki page:


reply via email to

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