From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: emulate readline Date: Wed, 06 Apr 2011 22:45:31 -0600 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1302151592 6267 80.91.229.12 (7 Apr 2011 04:46:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 7 Apr 2011 04:46:32 +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 06:46:28 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 1Q7h6w-0003DO-K8 for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Apr 2011 06:46:26 +0200 Original-Received: from localhost ([127.0.0.1]:43167 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7h6w-0006W7-1Y for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Apr 2011 00:46:26 -0400 Original-Received: from [140.186.70.92] (port=38730 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7h6L-0006V0-Th for help-gnu-emacs@gnu.org; Thu, 07 Apr 2011 00:45:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7h6K-0007ol-Am for help-gnu-emacs@gnu.org; Thu, 07 Apr 2011 00:45:49 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:59255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7h6K-0007oJ-2e for help-gnu-emacs@gnu.org; Thu, 07 Apr 2011 00:45:48 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q7h6H-0002bA-GC for help-gnu-emacs@gnu.org; Thu, 07 Apr 2011 06:45:45 +0200 Original-Received: from c-24-8-96-241.hsd1.co.comcast.net ([24.8.96.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Apr 2011 06:45:45 +0200 Original-Received: from kevin.d.rodgers by c-24-8-96-241.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Apr 2011 06:45:45 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-24-8-96-241.hsd1.co.comcast.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:80650 Archived-At: On 4/6/11 1:01 PM, fork wrote: > verizon.net> writes: >> >> M-p > > That doesn't match -- if I type "eva" I should be able to get "eval-region" > (since that is in my history), but it gives me my latest command "pa" instead. M-r REGEXP RET e.g. M-r eva RET The missing functionality is to get M-r (previous-matching-history-element) to use the current minibuffer contents as REGEXP, possibly anchored to only match commands that begin with that. Here's what I came up with: ;; Like previous-matching-history-element, but use the current minibuffer ;; contents as REGEXP: (defun previous-matching-history-element-default () (interactive) (previous-matching-history-element (concat "\\`" (regexp-quote (minibuffer-contents))) (prefix-numeric-value current-prefix-arg))) ;; Bind to M-R to preserve M-r: (define-key minibuffer-local-map "\M-R" 'previous-matching-history-element-default) For completeness, define next-matching-history-element-default to call next-matching-history-element, and bind it to M-S. -- Kevin Rodgers Denver, Colorado, USA