[Top][All Lists]

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

Re: Yanking isearch to highlight-regexp

From: Lennart Borgman (gmail)
Subject: Re: Yanking isearch to highlight-regexp
Date: Sun, 15 Jun 2008 23:10:25 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Juri Linkov wrote:
Why is not C-x w h always bound to higlight-regexp?

I think the key `C-x w' by its mnemonics would be more suitable for
a command that writes to the file like `C-x C-w'.

As the comment in hi-lock.el suggests to bind it rather to `C-z h',

I just want the key binding to be the same as I use outside of isearch.

There were no global binding for `occur' so in that case I thought `M-s o' was good, but in this case I would really prefer the same binding inside isearch. My rather cryptic patch to hi-lock.el provided that - you are very welcome to make it better if you want.

below is a patch for isearch.el with a new command `isearch-highlight-regexp'
bound to `M-s h'.  It is equivalent to the previously implemented
`isearch-occur' in regard to calling the command with the last isearch
string/regexp.  `isearch-highlight-regexp' is a useful command, and
it is much better than setting `lazy-highlight-cleanup' to nil, because
`lazy-highlight-cleanup' leaves highlighting limited only to the current
window boundaries, whereas `highlight-regexp' highlights the entire buffer.

As for the separate case of running `highlight-regexp' after isearch is
finished, I suggest using the same default values as already provided by
`occur-read-primary-args' and `keep-lines-read-args' that collect a list
of useful regexps from different places including the last isearch string
and put them to the list of default values.

I am not sure I understand this. If highlight-regexp is bound to `C-x w h' and I type that at the isearch prompt would that start that highlight-regexp with the current isearch regexp as the default regexp at the prompt?

This also suggests to get rid of `hi-lock-regexp-history' in favor of
the single regexp history variable `regexp-history' shared among all
regexp-reading commands (perhaps `keep-lines-read-args' should be
renamed to more general name like `read-regexp').


reply via email to

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