unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Cannot remap umlaut keys
@ 2003-11-07 17:08 Andreas Voegele
  2003-11-07 18:21 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Voegele @ 2003-11-07 17:08 UTC (permalink / raw)


I used to remap the umlaut keys in CC Mode but the following key
bindings no longer work when Emacs 21.3.1 is run under X.  The
bindings work if Emacs is started on the Linux console though.

(add-hook 'c-mode-common-hook
 '(lambda ()
    (local-set-key [?\366] "{")    ; ö -> {
    (local-set-key [?\344] "}")    ; ä -> }
    (local-set-key [?\326] "[")    ; Ö -> [
    (local-set-key [?\304] "]")    ; Ä -> ]
    (local-set-key [?\337] "\\"))) ; ß -> \

Is there another way to remap the umlaut keys that works under X and
on the Linux console?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-07 17:08 Cannot remap umlaut keys Andreas Voegele
@ 2003-11-07 18:21 ` Stefan Monnier
  2003-11-07 19:57   ` Andreas Voegele
  2003-11-07 21:02   ` Reiner Steib
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2003-11-07 18:21 UTC (permalink / raw)


> I used to remap the umlaut keys in CC Mode but the following key
> bindings no longer work when Emacs 21.3.1 is run under X.  The
> bindings work if Emacs is started on the Linux console though.

> (add-hook 'c-mode-common-hook
>  '(lambda ()
>     (local-set-key [?\366] "{")    ; ö -> {
>     (local-set-key [?\344] "}")    ; ä -> }
>     (local-set-key [?\326] "[")    ; Ö -> [
>     (local-set-key [?\304] "]")    ; Ä -> ]
>     (local-set-key [?\337] "\\"))) ; ß -> \

?\366 is not the same as ö.  How about

   (local-set-key [ö] "{")

This might not always work, tho.  If it doesn't, then maybe your
locale is not set properly.  The problem is that the .emacs file
should be in the same coding-system as your keyboard (and the
keyboard's coding system under X is determined by your locale).


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-07 18:21 ` Stefan Monnier
@ 2003-11-07 19:57   ` Andreas Voegele
  2003-11-10 16:17     ` Stefan Monnier
  2003-11-07 21:02   ` Reiner Steib
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Voegele @ 2003-11-07 19:57 UTC (permalink / raw)


Stefan Monnier writes:

>> I used to remap the umlaut keys in CC Mode but the following key
>> bindings no longer work when Emacs 21.3.1 is run under X.  The
>> bindings work if Emacs is started on the Linux console though.
>
>> (add-hook 'c-mode-common-hook
>>  '(lambda ()
>>     (local-set-key [?\366] "{")    ; ö -> {
>>     (local-set-key [?\344] "}")    ; ä -> }
>>     (local-set-key [?\326] "[")    ; Ö -> [
>>     (local-set-key [?\304] "]")    ; Ä -> ]
>>     (local-set-key [?\337] "\\"))) ; ß -> \
>
> ?\366 is not the same as ö.  How about
>
>    (local-set-key [ö] "{")

[ö] or [?ö]?  I forgot to mention that I tried to use [?ö] before I
posted my article.  [?ö] (or [ö]) neither works under X *nor* on the
console.

    state 0x0, keycode 47 (keysym 0xf6, odiaeresis), same_screen YES,
    XLookupString gives 1 bytes:  "ö"

I'm pretty sure that [?\366] worked in earlier versions of Emacs.  I
think that I started to use the above piece of code when Emacs 19 was
current.

> This might not always work, tho.  If it doesn't, then maybe your
> locale is not set properly.

The locale is set to de_DE.iso88591 which, according to "locale -a" is
supported by the C library. I also tried to use de_DE.

> The problem is that the .emacs file should be in the same
> coding-system as your keyboard (and the keyboard's coding system
> under X is determined by your locale).

My .emacs is encoded in ASCII.  I encoded it in Latin-1 when I
experimented with [?ö].  I also tried UTF-8.

I just realized that (local-set-key [?ö] "{") works under X if the
expression is executed from within the buffer that contains the C
file.  If the expression is evaluated in the c-mode-common-hook it
doesn't work.  On the other hand, it is no problem to bind { to keys
like f1, return or a, for example.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-07 18:21 ` Stefan Monnier
  2003-11-07 19:57   ` Andreas Voegele
@ 2003-11-07 21:02   ` Reiner Steib
  2003-11-08  1:23     ` Andreas Voegele
  1 sibling, 1 reply; 11+ messages in thread
From: Reiner Steib @ 2003-11-07 21:02 UTC (permalink / raw)


On Fri, Nov 07 2003, Stefan Monnier wrote:

>    (local-set-key [ö] "{")
>
> This might not always work, tho.  If it doesn't, then maybe your
> locale is not set properly.  The problem is that the .emacs file
> should be in the same coding-system as your keyboard (and the
> keyboard's coding system under X is determined by your locale).

In Emacs 21.3, with LC_CTYPE=en_US.ISO_8859-1, I tested this:

,----[ ~/.emacs (complete, nothing else) ]
| (global-set-key [2276] 'test2276) ; ä
| (global-set-key [ö]    'testoe) ; ö
| (global-set-key [252]  'test252) ; ü
`----

Result:

ä -> Symbol's function definition is void: test2276
ö -> ö (i.e. self-insert-command)
ü -> ü (i.e. self-insert-command)

Bye, Reiner.

Followup-To: gnu.emacs.help; Andreas, I doesn't make much sense to
post in English to a German speaking newsgroup (additionally, in
d.c.e, you should tag Emacs questions with "[Emacs]").
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-07 21:02   ` Reiner Steib
@ 2003-11-08  1:23     ` Andreas Voegele
  2003-11-08 12:34       ` Reiner Steib
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Voegele @ 2003-11-08  1:23 UTC (permalink / raw)


Reiner Steib writes:

> On Fri, Nov 07 2003, Stefan Monnier wrote:
>
>>    (local-set-key [ö] "{")
>>
>> This might not always work, tho.  If it doesn't, then maybe your
>> locale is not set properly.  The problem is that the .emacs file
>> should be in the same coding-system as your keyboard (and the
>> keyboard's coding system under X is determined by your locale).
>
> In Emacs 21.3, with LC_CTYPE=en_US.ISO_8859-1, I tested this:
>
> ,----[ ~/.emacs (complete, nothing else) ]
> | (global-set-key [2276] 'test2276) ; ä

Thanks, that works.  Does this mean that I have to maintain different
bindings for unibyte and multibyte mode?

> Bye, Reiner.
>
> Followup-To: gnu.emacs.help; Andreas, I doesn't make much sense to
> post in English to a German speaking newsgroup (additionally, in
> d.c.e, you should tag Emacs questions with "[Emacs]").

Okay.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-08  1:23     ` Andreas Voegele
@ 2003-11-08 12:34       ` Reiner Steib
  0 siblings, 0 replies; 11+ messages in thread
From: Reiner Steib @ 2003-11-08 12:34 UTC (permalink / raw)


On Sat, Nov 08 2003, Andreas Voegele wrote:

> Reiner Steib writes:
[...]
>> In Emacs 21.3, with LC_CTYPE=en_US.ISO_8859-1, I tested this:
>>
>> ,----[ ~/.emacs (complete, nothing else) ]
>> | (global-set-key [2276] 'test2276) ; ä
>
> Thanks, that works.  Does this mean that I have to maintain different
> bindings for unibyte and multibyte mode?

I don't know.  I don't even understand _why_ this alternative works
opposed to the others. :-/ I'm sure Stefan can explain.  The thread
around <news:5lr8kyfhi4.fsf@rum.cs.yale.edu> [1] may also be
interesting.  BTW: It seems that Stefan's explanations don't exactly
apply to Emacs 21.3 (and 21.2).

Why do you want to use unibyte mode in the first place?

Bye, Reiner.

[1] Enter the Message-Id "5lr8kyfhi4.fsf@rum.cs.yale.edu" in Google
    Groups advanced search form.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-07 19:57   ` Andreas Voegele
@ 2003-11-10 16:17     ` Stefan Monnier
  2003-11-12  8:12       ` Andreas Voegele
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2003-11-10 16:17 UTC (permalink / raw)


>> (local-set-key [ö] "{")
> [ö] or [?ö]?

Oops, it should have been [?ö] indeed.

> I forgot to mention that I tried to use [?ö] before I posted my article.
> [?ö] (or [ö]) neither works under X *nor* on the console.

>     state 0x0, keycode 47 (keysym 0xf6, odiaeresis), same_screen YES,
>     XLookupString gives 1 bytes:  "ö"

> I'm pretty sure that [?\366] worked in earlier versions of Emacs.  I
> think that I started to use the above piece of code when Emacs 19 was
> current.

No doubt about that.  But I fixed this Emacs-19 bug ;-)

>> This might not always work, tho.  If it doesn't, then maybe your
>> locale is not set properly.

> The locale is set to de_DE.iso88591 which, according to "locale -a" is
> supported by the C library. I also tried to use de_DE.

Hmm... it should have worked.

> My .emacs is encoded in ASCII.  I encoded it in Latin-1 when I
> experimented with [?ö].  I also tried UTF-8.

Have you tried putting a -*- coding: latin-1 -*- on the first line
to make sure that it is read with the proper coding system ?

The problem is that there are many different ö characters in Emacs
and it's important that Emacs read it as (make-char 'latin-iso8859-1 118)
(i.e. 2294) since it is the event generated by Emacs for the odiaeresis
key in an iso-8859-1 locale.


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-10 16:17     ` Stefan Monnier
@ 2003-11-12  8:12       ` Andreas Voegele
  2003-11-12 13:53         ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Voegele @ 2003-11-12  8:12 UTC (permalink / raw)


Stefan Monnier writes:

>> My .emacs is encoded in ASCII.  I encoded it in Latin-1 when I
>> experimented with [?ö].  I also tried UTF-8.
>
> Have you tried putting a -*- coding: latin-1 -*- on the first line
> to make sure that it is read with the proper coding system ?

I should have thought of setting the coding explicitly.  I use -*-
coding: utf-8 -*- in a lot of other files.

There's still the problem that I have to use (local-set-key [246] "(")
on the Linux text console in addition to (local-set-key [?ö] "("),
which only works under X.  But I can live with this minor problem.

-- 
Andreas

F'up set to gnu.emacs.help.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-12  8:12       ` Andreas Voegele
@ 2003-11-12 13:53         ` Stefan Monnier
  2003-11-14 13:11           ` Andreas Voegele
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2003-11-12 13:53 UTC (permalink / raw)


>>> My .emacs is encoded in ASCII.  I encoded it in Latin-1 when I
>>> experimented with [?ö].  I also tried UTF-8.
>> 
>> Have you tried putting a -*- coding: latin-1 -*- on the first line
>> to make sure that it is read with the proper coding system ?

> I should have thought of setting the coding explicitly.  I use -*-
> coding: utf-8 -*- in a lot of other files.

The -*- coding -*- thingy should not be necessary.  It seems to work OK for
me with Emacs-CVS and LANG=fr_CH.iso-8859-1, but if you could check it
yourself it would be helpful.

> There's still the problem that I have to use (local-set-key [246] "(")
> on the Linux text console in addition to (local-set-key [?ö] "("),
> which only works under X.  But I can live with this minor problem.

(local-set-key [?ö] "(") should work in the console as well, although it
might require a (set-keyboard-coding-system 'latin-1) or something
like that (in Emacs-CVS, the keyboard coding-system should be set
automatically based on the locale).


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-12 13:53         ` Stefan Monnier
@ 2003-11-14 13:11           ` Andreas Voegele
  2003-11-14 17:23             ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Voegele @ 2003-11-14 13:11 UTC (permalink / raw)


Stefan Monnier writes:

> The -*- coding -*- thingy should not be necessary.  It seems to work
> OK for me with Emacs-CVS and LANG=fr_CH.iso-8859-1, but if you could
> check it yourself it would be helpful.
>
> [...] (in Emacs-CVS, the keyboard coding-system should be set
> automatically based on the locale).

I've just built Emacs-CVS and I can confirm that the coding is
recognized properly.  The keyboard coding-system is also set
automatically.

I think I'll stick to the CVS version.  The list of changes is quite
impressive.

Thanks a lot for your help.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Cannot remap umlaut keys
  2003-11-14 13:11           ` Andreas Voegele
@ 2003-11-14 17:23             ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2003-11-14 17:23 UTC (permalink / raw)


>> [...] (in Emacs-CVS, the keyboard coding-system should be set
>> automatically based on the locale).
> I've just built Emacs-CVS and I can confirm that the coding is
> recognized properly.  The keyboard coding-system is also set
> automatically.

Thank you for testing it.

> I think I'll stick to the CVS version.  The list of changes is quite
> impressive.

;-)


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-11-14 17:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-07 17:08 Cannot remap umlaut keys Andreas Voegele
2003-11-07 18:21 ` Stefan Monnier
2003-11-07 19:57   ` Andreas Voegele
2003-11-10 16:17     ` Stefan Monnier
2003-11-12  8:12       ` Andreas Voegele
2003-11-12 13:53         ` Stefan Monnier
2003-11-14 13:11           ` Andreas Voegele
2003-11-14 17:23             ` Stefan Monnier
2003-11-07 21:02   ` Reiner Steib
2003-11-08  1:23     ` Andreas Voegele
2003-11-08 12:34       ` Reiner Steib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).