From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: emulate readline Date: Thu, 07 Apr 2011 12:32:08 +0200 Organization: aich tea tea pea dicky riley dot net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1302176454 7750 80.91.229.12 (7 Apr 2011 11:40:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Apr 2011 11:40:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 07 13:40:49 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7nZx-0002Tu-H5 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Apr 2011 13:40:49 +0200 Original-Received: from localhost ([127.0.0.1]:56099 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7nZw-00011r-T3 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Apr 2011 07:40:48 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!feeder.erje.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!uio.no!quimby.gnus.org!richardriley.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: 85.183.18.158 Original-X-Trace: quimby.gnus.org 1302174450 15556 85.183.18.158 (7 Apr 2011 11:07:30 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Thu, 7 Apr 2011 11:07:30 +0000 (UTC) User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:gLpMkCf60TsQj0mGqLeuTuFOe5M= Original-Xref: usenet.stanford.edu gnu.emacs.help:186544 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80656 Archived-At: Le Wang writes: > On Thu, Apr 7, 2011 at 1:04 AM, fork 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.