- Subject: Re: Re: Search and Replace
- From: Guenter Milde <G.Milde@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Mar 2002 10:26:18 +0100 (CET)
On Thu, 14 Mar 2002 16:01:18 +0100 (CET) wrote Jørgen Larsen <jl@xxxxxxxxxxxx>:
> > Furthermore, I'd like support for Isearch included.
>
> I must admit that I don't use isearch (but maybe I should learn it ?), so I
> didn't think about support for isearch, either.
Well, I do and so isearch would play a major part in my (still hypothetical) xsearch module.
( Try M-x "isearch_forward": You will be prompted for a search string as
usual, but the search starts after the first letter given. Everytime you
put in a letter, isearch will look for the next occurence of the string
given so far - this way you can finish the search (by ESC or an Arrow-key,
say) as soon as you realize that you reached the right place - saving some
keystrokes in the course of the day.
Personally, I don't like the default keybinding of the "find-next"
feature, I solve this with the "custom variable setting" variable
Isearch_Forward_Char = 13; % <Return> finds next match
in my .jedrc.)
> > ^F Forward Search \
> > | Keybinding clash to be solved
> > ^F simple search /
>
> Direction could be
> ^U Up (= backwards in the text)
> ^D Down (= forwards in the text)
I found a simpler solution: drop the special binding for "simple
search", as this can be called with
"S" search for string
"W" search for word
(I would like to keep the Forward/Backward mnemonic which is the one more
clear (IMHO) and the one used in the menu (Search Forward/Search Backward).
> There would be a problem in using it with ide mode, because it uses a lot
> of ^Q-combis:
...
> I guess that ide mode would have to use a two-key combination (^Q^F)
> to enter into the search interface.
I see. However, one could use the information in the two-key sequence to go
to the right place in the first case:
^Q^A xsearch_replace % replace with settings from last run or defaults
^Q^F xsearch_find % find with settings from last run or defaults
Furthermore, we need to make the bindings customizable (of course). I'd
favour to call a xsearch_mode_hook() that could modify the bindings in the
"Xsearch" keymap via local_setkey(...) commands.
The defaults in my revised version would be:
In cua_mode:
^F xsearch() % Start a search/replace action with the settings from the
% last invocation or defaults (depending on the setting of
% a custom variable)
Xsearch keymap:
% Parameter Settings:
^B Xsearch_direction = "backward"; % doesnot start a search but affects
^F Xsearch_direction = "forward"; % current and future searchs
^T toggle_case(); % toggle CASE_SEARCH or REPLACE_PRESERVE_CASE,
% depending on the current setting of Xsearch_type
% Search type/Target:
^I Xsearch_type = "Incremental"; xsearch();
^R Xsearch_type = "Replace"; xsearch();
^S Xsearch_type = "String"; xsearch();
^W Xsearch_type = "Word"; xsearch();
^X Xsearch_type = "regeXp"; xsearch();
% Escape Character:
` quoted_insert % (to enable search for characters like ^R)
- A switch of search-type or direction would keep the search-string in
the minibuffer.
- If a region is defined, it will become the initialization string for
a search/replace action.
Furthermore,
if (Xsearch_type == "Incremental" and NoIsearchWhenRegionDefined == 1)
a string-search for the region will take place.
- If no region is defined, the current word will become the initialization
string for a replace action and the default string for a search.
- An interesting option would be to use Dinos config.sl (or parts of) to
get help-dialog (a buffer with the current settings and the possibility to
change these transparently)
But before I start programming, I'd like to discuss the whole thing a bit
more and also hear the meaning of the community.
Guenter
--
G.Milde@xxxxxxxxxxxxxxxxxxxx
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]