[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Isearch - Incremental search with predefined initial character?
From: |
Drew Adams |
Subject: |
RE: Isearch - Incremental search with predefined initial character? |
Date: |
Wed, 8 Oct 2014 15:32:03 -0700 (PDT) |
> After fiddling a while, I came up with this, which does what I want.
> ...
> Thank you very much for your help. Pointing me at (isearch-yank-
> string ...) made this work.
You're welcome.
> I wish to do this so that I can search for "{abc" without typing the
> "{" first. Typing something like "\C-s{abc" is exhausting.
You have what you want. And the string you want as a prefix each
time is just one char in this case (`{`). Things would be a lot
more exhausting if the commonly used prefix were a complex string!
Anyway, just FYI, in case you have other things that you sometimes
want to yank into the search string, here are two tips (they require
libraries `isearch+.el' and `second-sel.el'):
1. You can use `C-M-y' to yank the secondary selection to the search
string.
The secondary selection does not change when the region changes,
so it is a good place to hold onto a string that you might use
fairly often but intermittently.
For example, it can be handy for a kind of on-demand replacement:
select something, then `C-M-y' to yank the secondary selection
in place of it (`C-w' first, if you don't use `delete-selection-mode').
You can't yank the region text to replace the region text (!), but
you can yank the secondary selection. And it remains as the same
text until you explicitly change it.
And unlike the region, point is generally nowhere near the secondary
selection, which means the s.s. can be off-window.
Most Emacs users never use the secondary selection. I use it all
the time. My guess is that people don't use it because they have
never bound it to a keyboard key (like `C-M-y'). The only default
key for yanking the s.s. is a mouse key (`M-mouse-2':
`mouse-yank-secondary').
2. You can use `C-x r g' to append the contents of a register to the
search string. This is the same key that is bound globally to
`insert-register'. You are prompted for the register (a character).