unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Rebinding keys
@ 2013-03-25 14:04 Nicolas Neuss
  2013-03-25 14:40 ` Mark Skilbeck
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Nicolas Neuss @ 2013-03-25 14:04 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

for rebinding Umlaute keys on a German keyboard to bindings which are
more useful for LaTeX, I tried the following

(global-set-key (kbd "ä") '(lambda () (interactive) (insert "]")))

This works when writing normal text, but unfortunately, in search mode
(after C-s, for example), pressing the respective key still searches for
"ä".

Is there a better or more complete way to redefine that key?

Thank you,

Nicolas

P.S.: This is on a Mac with Aquamacs, but the same happens with Emacs 23
under Ubuntu.

P.S.2: Under Linux/X, I usually use .xmodmap for rebinding the umlaute
keys for all applications.  Does anyone here know of a similar key
rebinding for Aqua?



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

* Re: Rebinding keys
  2013-03-25 14:04 Rebinding keys Nicolas Neuss
@ 2013-03-25 14:40 ` Mark Skilbeck
  2013-03-25 16:07   ` Mark Skilbeck
       [not found]   ` <mailman.22810.1364227676.855.help-gnu-emacs@gnu.org>
  2013-03-25 15:33 ` Peter Dyballa
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Mark Skilbeck @ 2013-03-25 14:40 UTC (permalink / raw)
  To: Nicolas Neuss; +Cc: help-gnu-emacs

Óla!

The following ought to work (it worked for me in C-s):

  (define-key key-translation-map [?ä] [?a])

-- mgsk

On Mon, Mar 25, 2013 at 03:04:19PM +0100, Nicolas Neuss wrote:
> Hi,
> 
> for rebinding Umlaute keys on a German keyboard to bindings which are
> more useful for LaTeX, I tried the following
> 
> (global-set-key (kbd "ä") '(lambda () (interactive) (insert "]")))
> 
> This works when writing normal text, but unfortunately, in search mode
> (after C-s, for example), pressing the respective key still searches for
> "ä".
> 
> Is there a better or more complete way to redefine that key?
> 
> Thank you,
> 
> Nicolas
> 
> P.S.: This is on a Mac with Aquamacs, but the same happens with Emacs 23
> under Ubuntu.
> 
> P.S.2: Under Linux/X, I usually use .xmodmap for rebinding the umlaute
> keys for all applications.  Does anyone here know of a similar key
> rebinding for Aqua?



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

* Re: Rebinding keys
  2013-03-25 14:04 Rebinding keys Nicolas Neuss
  2013-03-25 14:40 ` Mark Skilbeck
@ 2013-03-25 15:33 ` Peter Dyballa
  2013-03-25 15:59 ` Peter Münster
       [not found] ` <mailman.22808.1364227190.855.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2013-03-25 15:33 UTC (permalink / raw)
  To: Nicolas Neuss; +Cc: help-gnu-emacs


Am 25.03.2013 um 15:04 schrieb Nicolas Neuss:

> Is there a better or more complete way to redefine that key?

Change the keyboard layout in Mac OS X! (With Ukulele, for example.)

--
Mit friedvollen Grüßen

  Pete

Theoretischer Unterbau, der:
	Aussage über einen hypothetischen Teil einer Fernsehansagerin




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

* Re: Rebinding keys
  2013-03-25 14:04 Rebinding keys Nicolas Neuss
  2013-03-25 14:40 ` Mark Skilbeck
  2013-03-25 15:33 ` Peter Dyballa
@ 2013-03-25 15:59 ` Peter Münster
  2013-03-25 16:05   ` Peter Dyballa
       [not found] ` <mailman.22808.1364227190.855.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2013-03-25 15:59 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, Mar 25 2013, Nicolas Neuss wrote:

> for rebinding Umlaute keys on a German keyboard to bindings which are
> more useful for LaTeX, I tried the following
>
> (global-set-key (kbd "ä") '(lambda () (interactive) (insert "]")))

Hi,

Why is (insert "]") more useful than "ä"?

-- 
           Peter




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

* Re: Rebinding keys
  2013-03-25 15:59 ` Peter Münster
@ 2013-03-25 16:05   ` Peter Dyballa
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2013-03-25 16:05 UTC (permalink / raw)
  To: Peter Münster; +Cc: help-gnu-emacs


Am 25.03.2013 um 16:59 schrieb Peter Münster:

> Why is (insert "]") more useful than "ä"?

Both alt-keys defective?

--
Mit friedvollen Grüßen

  Pete

"Once you've heard Beefheart, it's hard to wash him out of your clothes."
				– Tom Waits







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

* Re: Rebinding keys
  2013-03-25 14:40 ` Mark Skilbeck
@ 2013-03-25 16:07   ` Mark Skilbeck
       [not found]   ` <mailman.22810.1364227676.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Mark Skilbeck @ 2013-03-25 16:07 UTC (permalink / raw)
  To: Nicolas Neuss; +Cc: help-gnu-emacs

Oops. That [?a] should be [?\]]

On Mon, Mar 25, 2013 at 02:40:34PM +0000, Mark Skilbeck wrote:
> Óla!
> 
> The following ought to work (it worked for me in C-s):
> 
>   (define-key key-translation-map [?ä] [?a])
> 
> -- mgsk
> 
> On Mon, Mar 25, 2013 at 03:04:19PM +0100, Nicolas Neuss wrote:
> > Hi,
> > 
> > for rebinding Umlaute keys on a German keyboard to bindings which are
> > more useful for LaTeX, I tried the following
> > 
> > (global-set-key (kbd "ä") '(lambda () (interactive) (insert "]")))
> > 
> > This works when writing normal text, but unfortunately, in search mode
> > (after C-s, for example), pressing the respective key still searches for
> > "ä".
> > 
> > Is there a better or more complete way to redefine that key?
> > 
> > Thank you,
> > 
> > Nicolas
> > 
> > P.S.: This is on a Mac with Aquamacs, but the same happens with Emacs 23
> > under Ubuntu.
> > 
> > P.S.2: Under Linux/X, I usually use .xmodmap for rebinding the umlaute
> > keys for all applications.  Does anyone here know of a similar key
> > rebinding for Aqua?



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

* Re: Rebinding keys
       [not found] ` <mailman.22808.1364227190.855.help-gnu-emacs@gnu.org>
@ 2013-03-25 18:07   ` Nicolas Neuss
  2013-03-25 20:20     ` Peter Münster
       [not found]     ` <mailman.22827.1364242843.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Neuss @ 2013-03-25 18:07 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Münster <pmlists@free.fr> writes:

> On Mon, Mar 25 2013, Nicolas Neuss wrote:
>
>> for rebinding Umlaute keys on a German keyboard to bindings which are
>> more useful for LaTeX, I tried the following
>>
>> (global-set-key (kbd "ä") '(lambda () (interactive) (insert "]")))
>
> Hi,
>
> Why is (insert "]") more useful than "ä"?

I often write English texts.

Nicolas


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

* Re: Rebinding keys
  2013-03-25 18:07   ` Nicolas Neuss
@ 2013-03-25 20:20     ` Peter Münster
  2013-03-25 22:06       ` Peter Dyballa
       [not found]     ` <mailman.22827.1364242843.855.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Peter Münster @ 2013-03-25 20:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Mon, Mar 25 2013, Nicolas Neuss wrote:

>> Why is (insert "]") more useful than "ä"?
>
> I often write English texts.

Thanks. So kind of "if LaTeX then English, else German".
(Be aware, that you'll need to change your habits when LaTeXing German
texts... ;)

If you ever need such special key-mappings outside of emacs, I recommend
xmodmap. For example, I use the following script for switching between
French and German:

--8<---------------cut here---------------start------------->8---
#!/bin/bash

# change between french and german keyboard

DIR=~/.fvwm
FLAG=$DIR/french
FRENCH=$DIR/Xmodmap.french
GERMAN=$DIR/Xmodmap.german

if [ "$1" = german ] || [ -f $FLAG -a -z "$1" ]; then
	xmodmap $GERMAN
	rm -f $FLAG
else
	xmodmap $FRENCH
	touch $FLAG
fi
--8<---------------cut here---------------end--------------->8---

-- 
           Peter




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

* Re: Rebinding keys
       [not found]     ` <mailman.22827.1364242843.855.help-gnu-emacs@gnu.org>
@ 2013-03-25 21:48       ` Nicolas Neuss
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Neuss @ 2013-03-25 21:48 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Münster <pmlists@free.fr> writes:

> On Mon, Mar 25 2013, Nicolas Neuss wrote:
>
>>> Why is (insert "]") more useful than "ä"?
>>
>> I often write English texts.
>
> Thanks. So kind of "if LaTeX then English, else German".
> (Be aware, that you'll need to change your habits when LaTeXing German
> texts... ;)

Not really.  See below.

> If you ever need such special key-mappings outside of emacs, I recommend
> xmodmap. 

Yes.  Maybe I wasn't clear enough, but on my Linux laptop I do the same
with my .xmodmap containing the following:

--8<---------------cut here---------------start------------->8---
keycode 47 = bracketleft braceleft odiaeresis Odiaeresis odiaeresis Odiaeresis
keycode 48 = bracketright braceright adiaeresis Adiaeresis adiaeresis Adiaeresis
keycode 34 = backslash asciitilde udiaeresis Udiaeresis udiaeresis Udiaeresis
keycode 115 = Alt_L
--8<---------------cut here---------------end--------------->8---

[You see, that I can obtain the German umlaute as a two-key combination
with Alt-R.  So I lose a little bit of typing speed with those, but
\~{}[] (which are frequently used in LaTeX with any language) are
single-key characters and faster to type.]

However, I (or, more precisely, my son) has got a Macintosh Power Book
and wants to use Aquamacs.  Since, the .xmodmap technique does not work
(I still have to try the suggestion with Ukulele), I reverted to
redefining keys in Emacs as a first remedy.

> For example, I use the following script for switching between
> French and German:
>
> #!/bin/bash
>
> # change between french and german keyboard
>
> DIR=~/.fvwm
> FLAG=$DIR/french
> FRENCH=$DIR/Xmodmap.french
> GERMAN=$DIR/Xmodmap.german
>
> if [ "$1" = german ] || [ -f $FLAG -a -z "$1" ]; then
> 	xmodmap $GERMAN
> 	rm -f $FLAG
> else
> 	xmodmap $FRENCH
> 	touch $FLAG
> fi

OK, that's probably a good idea.

Thanks for the feedback,

Nicolas






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

* Re: Rebinding keys
       [not found]   ` <mailman.22810.1364227676.855.help-gnu-emacs@gnu.org>
@ 2013-03-25 21:59     ` Nicolas Neuss
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Neuss @ 2013-03-25 21:59 UTC (permalink / raw)
  To: help-gnu-emacs

Mark Skilbeck <m@iammark.us> writes:

> Oops. That [?a] should be [?\]]
>
> On Mon, Mar 25, 2013 at 02:40:34PM +0000, Mark Skilbeck wrote:
>> Óla!
>> 
>> The following ought to work (it worked for me in C-s):
>> 
>>   (define-key key-translation-map [?ä] [?a])
>> 
>> -- mgsk

Thank you, Mark, this works.  

[And thanks also for all the other suggestions I got in this thread.  As
always, gnu.emacs.help has been a great resource.]

Nicolas



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

* Re: Rebinding keys
  2013-03-25 20:20     ` Peter Münster
@ 2013-03-25 22:06       ` Peter Dyballa
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2013-03-25 22:06 UTC (permalink / raw)
  To: Peter Münster; +Cc: help-gnu-emacs


Am 25.03.2013 um 21:20 schrieb Peter Münster:

> If you ever need such special key-mappings outside of emacs, I recommend
> xmodmap.

There are GNU Emacs variants that run natively in Aqua, the Mac OS X windowing system. Without X11.

Mac OS X also offers to easily switch the keyboard layout from a menu in the  menu bar (when enabled from System Preferences). It's possible to modify and save an existing keyboard layout with http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele and then use this layout. The disadvantage is: /all/ applications receive these modified key events. (And a vivid user community exists.)

--
Mit friedvollen Grüßen

  Pete

Cyanide is so poisonous that one drop of it on a dog's tongue will kill the strongest man.






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

end of thread, other threads:[~2013-03-25 22:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 14:04 Rebinding keys Nicolas Neuss
2013-03-25 14:40 ` Mark Skilbeck
2013-03-25 16:07   ` Mark Skilbeck
     [not found]   ` <mailman.22810.1364227676.855.help-gnu-emacs@gnu.org>
2013-03-25 21:59     ` Nicolas Neuss
2013-03-25 15:33 ` Peter Dyballa
2013-03-25 15:59 ` Peter Münster
2013-03-25 16:05   ` Peter Dyballa
     [not found] ` <mailman.22808.1364227190.855.help-gnu-emacs@gnu.org>
2013-03-25 18:07   ` Nicolas Neuss
2013-03-25 20:20     ` Peter Münster
2013-03-25 22:06       ` Peter Dyballa
     [not found]     ` <mailman.22827.1364242843.855.help-gnu-emacs@gnu.org>
2013-03-25 21:48       ` Nicolas Neuss

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).