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

Re: [StrongED] ensuring advanced search-and-replace



In message <d9a3234a55.jim@xxxxxxxxxxxxxx>
          Jim Nagel <stred@xxxxxxxxxxxxxxxx> wrote:

> Fred Graute  wrote on 30 Jan:
> > With Keystroke suitably modified it is now possible to force the S&R
> > dialogue to 'advanced' mode. Still feels like the long way round though
> > as it's much easier to define a toolbar icon / keystroke / menu item in
> > StrongED itself.
>
> The phrase "above & beyond" comes to mind!  Thanks, Fred.

No problem, it was an interesting challenge.

> Is this revised !Keystroke available somewhere?

No, all I did was comment out line 620 in KeysLib (Keystroke v4.09b).
Obviously this is not suited for permanent use as it leaves menus open
after Keystroke sends a Menu Selection message.

> I don't think I ever explained the recurrent situation where I have
> been using this keystroke.  It's when viewing an email in MPro after
> saving an attachment off to disc somewhere and then stripping it from
> the email:  I make a habit of inserting a note at the top of the email
> to remind me the location on disc.
>
> So my keystroke does F8 to open the raw email in StrongEd, then
> searches for the two blank lines that mark the end of the headers,
> then inserts "||  " and waits for me to type my reminder.  (The || is
> just my own convention as prefix such notes, because when the textfile
> is saved back, MPro displays the note in red.)

Thanks, it's always useful to see how something is used.

> How would I go about defining this (as you suggest) in SE itself
> rather than using Keystroke?  Maybe in a modefile for raw email?

Yes, assuming that a suitable ModeWhen rule can be created to force load
raw emails into that mode. You'd then create a Functions section with a
suitable definition, say:

Functions
        Icon    <sprite name>
        Menu    <menu item text>
        Help    <help text>
        Key     <keystroke>
        Select  Replace(<search>,<replace>,<scope>,<line>,<case>)
End

<search> would be an advanced search expression that matches two
newlines (\n\n), and <replace> would be an expression that adds two
pipes (@@ "||").

<search> is set in the Search section and <replace> in the Replace
section of a ModeFile.

You could also use the OnLoad keyword. Then the replace would be done
automatically when a raw email is loaded into the mode.

OnLoad  Replace(<search>,<replace>,<scope>,<line>,<case>)

Cheers,
Fred.

-- 
StrongED Developer
http://www.stronged.iconbar.com/

--=20
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx
List archives at http://www.Torrens.org.uk/RO/StrongED/index.html