[Top][All Lists]

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

Re: emulate readline

From: Kevin Rodgers
Subject: Re: emulate readline
Date: Wed, 06 Apr 2011 22:45:31 -0600
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv: Gecko/20110303 Thunderbird/3.1.9

On 4/6/11 1:01 PM, fork wrote:
  <despen<at>>  writes:


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 ()
  (previous-matching-history-element (concat "\\`" (regexp-quote
                                     (prefix-numeric-value current-prefix-arg)))

;; Bind to M-R to preserve M-r:
(define-key minibuffer-local-map "\M-R" 

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

reply via email to

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