help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remapping keys


From: Juanma
Subject: Re: remapping keys
Date: Wed, 20 Feb 2008 03:12:34 +0100
User-agent: KMail/1.9.5

On Wednesday 20 February 2008 01:32, Sam Peterson wrote:
> Wow, a whole thread on remapping keys, and NOBODY mentions
> global-set-key or local-set-key.
>
> ;; just an example, change the keys to whatever you like
> (global-set-key "{" '(lambda () (interactive) (insert "a")))
>
> Many will argue that keyboard translate is better.  Whatever works...

I thought of it but I rejected it because the point is not just to get a curly 
bracket inserted in the text, but also to use it in keystrokes, which I guess 
can't be done with that lambda form. I can't figure any other way to do it 
than keyboard-translate. Involving only Emacs in the solution, that is.

Sadly, no approach solves the problem. Neither the above lambda form, nor 
keyboard-translate¹, nor define-key² provide a substitution of keys 
throughout the whole Emacs cathedral: in keystrokes the original key still 
applies.

¹: (keyboard-translate ?. ?/)
²: (define-key global-map (kbd ".") (kbd "/"))

In any of these cases, asking for the command mapped to M-. will give exactly 
that, not the command mapped to M-/ as intended.

It is still possible to re-map *all* keystrokes using curly brackets to make 
them use something more comfortable, but ... well, no way.

Juanma





reply via email to

[Prev in Thread] Current Thread [Next in Thread]