- Subject: Re: Non-ascii chars in UTF-8 mode not bindable
- From: "G. Milde" <milde@xxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 29 May 2007 13:24:22 +0200
On 29.05.07, Jörg Sommer wrote:
> when you run jed or xjed in utf8???mode you can't bind functions to
> non???ascii keys like °, ´ or ¬, because they are multibyte sequences and
> they start all with the same charater. If you bind one, you loose all
> other.
I can not verify this here. If a multibyte sequence is bound, only the
single-bit sequence that starts with the same byte is "lost".
Günter
The following code works for me in both, latin-1 and utf-8
(it is a revised version of an earlier receipe to re-bind Umlaut keys to
symbols that is helpfull when editing source code):
% Bind Umlauts to often used Chars (but not in comments)
% ------------------------------------------------------
if (_slang_utf8_ok)
private variable umlauts = ["ö", "�", "ä", "�", "ü", "�", "�"];
else
private variable umlauts = ["ö", "Ö", "ä", "Ä", "ü", "Ü", "ß"];
private variable specials = ["[", "{", "]", "}", "@", "~", "\\\\"];
% if in comment, insert verbatim, else insert argument
define programming_key_insert(ch)
{
if (parse_to_point() == -2)
insert(LASTKEY);
else
insert(ch);
}
public define set_programming_keys()
{
variable i, fun;
for (i=0; i<length(umlauts); i++)
{
fun = sprintf("programming_key_insert(\"%s\")", specials[i]);
local_setkey(fun, umlauts[i]);
}
% use enhanced paragraph formatting from subpar.sl
#ifexists par
set_buffer_hook("format_paragraph_hook", "par");
#endif
}
public define reset_programming_keys()
{
variable i;
for (i=0; i<length(umlauts); i++)
{
local_setkey("self_insert_cmd", umlauts[i]);
}
}
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2007 date index]
[2007 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]