all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Le Wang <l26wang@gmail.com>
To: fork <forkandwait@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: emulate readline
Date: Thu, 7 Apr 2011 09:48:53 +0800	[thread overview]
Message-ID: <BANLkTimDCE0LKQnjziEY3quhebi0+7v2Uw@mail.gmail.com> (raw)
In-Reply-To: <loom.20110406T184454-585@post.gmane.org>

On Thu, Apr 7, 2011 at 1:04 AM, fork <forkandwait@gmail.com> 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

--
Le



  parent reply	other threads:[~2011-04-07  1:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 17:04 emulate readline fork
2011-04-06 18:01 ` Eli Zaretskii
2011-04-06 18:53   ` fork
     [not found]   ` <mailman.11.1302116146.29474.help-gnu-emacs@gnu.org>
2011-04-06 19:14     ` despen
2011-04-06 19:59       ` fork
     [not found]       ` <mailman.19.1302119959.29474.help-gnu-emacs@gnu.org>
2011-04-06 23:44         ` despen
2011-04-07 16:44           ` fork
2011-04-06 19:19 ` Peter Dyballa
2011-04-06 19:23   ` fork
2011-04-06 19:36     ` Peter Dyballa
2011-04-06 19:44       ` fork
2011-04-06 20:21         ` Peter Dyballa
2011-04-06 20:29           ` fork
2011-04-06 20:45         ` Drew Adams
2011-04-06 21:23           ` fork
2011-04-07  1:48 ` Le Wang [this message]
2011-04-07 15:09   ` fork
     [not found] ` <mailman.0.1302140940.25667.help-gnu-emacs@gnu.org>
2011-04-07 10:32   ` Richard Riley
     [not found] <mailman.1.1302109600.30021.help-gnu-emacs@gnu.org>
2011-04-06 17:52 ` despen
2011-04-06 19:01   ` fork
2011-04-07  4:45     ` Kevin Rodgers
2011-04-06 19:06   ` Richard Riley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTimDCE0LKQnjziEY3quhebi0+7v2Uw@mail.gmail.com \
    --to=l26wang@gmail.com \
    --cc=forkandwait@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.