[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:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
On 4/6/11 1:01 PM, fork wrote:
<despen<at> 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
Re: emulate readline, Le Wang, 2011/04/06
Message not available
Re: emulate readline, despen, 2011/04/06