jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Replacing certain characters


On 22.04.04, dvv wrote:
> Hi!
> I'm editing SGML docs and would like to replace certain letters (Bulgarian 
> "ia") automatically.

Unfortunately, I do not understand the Emacs or Vi syntax, so I do not know
exactly what you need.

> How can I do this in jed? I tried turning on emacs emulation in my .jedrc 
> and after that pasting the emacs config - didn't work well.

Emacs emulation only emulates the look-and-feel (keybindings + some settings),
it doesnot include parsing lisp...

> Other approaches I have thought of are variables, replace_fsearch(), 
> replace_match().

To replace existing characters, rename and adapt the example below to 
your chars and put into .jedrc (or jed.rc on windows).

public define latin12html()
{  variable old_case_search = CASE_SEARCH;
   CASE_SEARCH = 1;
   push_spot();
   % if(is_visible_mark) narrow;
   bob;
   replace("ö","ö");   replace("Ö","Ö");
   CASE_SEARCH =  old_case_search;
   % widen;
   pop_spot();
}

To have custom keybindings, you can do something like

% bind Umlauts to often used Chars
public define htmlentity_keys()
{
   local_setkey(" ö", "ö");
   local_setkey(" Ö", "Ö");
   % ...
}

And to activate it define a hook that gets called automatically when a
buffer is set to html_mode. (Change this to sgml_mode_hook, or whatever
mode you use for editing the sgml files.)

define html_mode_hook() 
{
   latin12html();
   htmlentity_keys();
}

Günter

-- 
G.Milde at web.de

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]