jed-users mailing list

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

Re: Replacing certain characters


G. Milde writes:
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.
Well I gave the vi and emacs examples, so that they could be as a hint.
Otherwise I'm translating FreeBSD SGML docs into Bulgarian CP1251 and the problem is that if I put small 'ia' instead of the symbol compilation fails. Also I refuse to use anything but jed for work ;-). With your help and the examples at http://profs.sci.univr.it/~gonzato/jed/jed-quickref.html#hooks and sgml_mode_hook() I think I'll handle the situation - the only thing I wasn't sure is quotes - single or double.Now I know - double. Does the name of the function latin12html matter and should I rename it cp12512sgml? My environment is set to bg_BG.CP1251 and I'm not very deep in encodings,iconv and recoding matters, therefore I suppose the name is somewhat of importance.
Afaik, Latin1 is an acronym for iso-8859-1 right?
I will sit tonight and test all.
Thanks very much!
Dimitar
<cut>

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("ц","&ouml;");   replace("Ц","&Ouml;");
   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(" &ouml;", "ц");
   local_setkey(" &Ouml;", "Ц");
   % ...
}
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();
}



--------------------------
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]