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

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

Re: How can I change the keys?


From: Xah Lee
Subject: Re: How can I change the keys?
Date: Fri, 11 Apr 2008 12:50:56 -0700 (PDT)
User-agent: G2/1.0

Cesar_BCN wrote:
«I'm trying to change the first keys row functionality. I want to
press a key (for instance: the '8' key) and emacs writte the symbol
that result of typing Shift+key (for instance: the '(' symbol ).»

I tried this for a few weeks sometimes in 2007 and find it not
satisfactory, partly because in other apps you then have to switch
your mental mode. A solution is to do it system-wide, but then when
you use other computers (library, coworker, etc), its still a problem.

Also, system-wide keymap change using default system technology do not
work satisfactorily under OSX for some technical complication reasons.
Namely, it is not possible to change certain basic keymaps. (in OS X
for example, certain key combination event is not seen by the system,
but other even/system take precedence)
(For technical detail, see bottom of:
  “Mac OS X Keybinding and Unicode Tips” at 
http://xahlee.org/emacs/osx_keybinding.html
)

A solution is to use 3rd-party software that actually modify the OS
core in some way.

I haven't tried to do extensive keymapping under unix (xmodmap) or
Windows, but i'm pretty sure the situation is similar.

-------------------

But to do what you want, see:
 How to Define Keyboard Shortcuts in Emacs
 http://xahlee.org/emacs/keyboard_shortcuts.html

basically like this:
 (global-set-key (kbd "1") (lambda () (insert "!")))
 ...
 (global-set-key (kbd "<kp-1>") (lambda () (insert "1")))
 ...

again there are complications. Some mode will actually not respect it.
(a solution is either to modify each mode's keymap or use some other
complicated elisp mechanism to rebind or swap keys) Also, NeXT Emacs
(aka “Emacs.app”) on the Mac has a bug that it doesn't support any
keybindings using the numerical keypad.

In summary, my experiences is that when you modify keybinding in some
unusual way (such as in your case), you run into other misc problems,
limitations, complications,... so at the end i find it not worthwhile.

Another suggestion is to type numbers by turning the keys under your
right hand into a keypad, with a modifier down. (similar to notebook
computer keyboards) I've tried this scheme by using Ctrl+Shift as the
modifier key... but again after a few weeks didn't find this
satisfactory.

---------------------

Personally, regardless of typing in emacs or elsewhere, i've developed
a habit in the past maybe 4 years to always type the num keys using
the top row (as opposed to the keypad). The keypad i used as special
buttons bind to emacs functions. (i.e. like giving you extra 10 or so
function keys)

To insert any matching pairs such as (), [], {}, “”,«»,「」etc, i've
bound them to hyper key with keys right under my right hand's home
row. (and cursor movement keys are similar but bound to meta) Example:

;; make cursor movement keys under right hand's home-row.
(global-set-key (kbd "M-j") 'backward-char) ; was indent-new-comment-
line
(global-set-key (kbd "M-l") 'forward-char)  ; was downcase-word
(global-set-key (kbd "M-i") 'previous-line) ; was tab-to-tab-stop
(global-set-key (kbd "M-k") 'next-line) ; was kill-sentence

(global-set-key (kbd "M-SPC") 'set-mark-command) ; was just-one-space

;; type parens in pairs with Hyper and right hands's home-row
(global-set-key (kbd "H-j") (lambda () (interactive) (insert "{}")
(backward-char 1)))
(global-set-key (kbd "H-k") (lambda () (interactive) (insert "()")
(backward-char 1)))
(global-set-key (kbd "H-l") (lambda () (interactive) (insert "[]")
(backward-char 1)))

Also, i've using dvorak since about 1993. Also, my emacs shortcuts set
is extensively modified. See:

 A Ergonomic Keyboard Shortcut Layout For Emacs
 http://xahlee.org/emacs/ergonomic_emacs_keybinding.html

  Xah
  xah@xahlee.org
∑ http://xahlee.org/

☄




On Apr 10, 3:15 pm, Cesar_BCN <cesar...@gmail.com> wrote:
> Hello
>
> I'm trying to change the first keys row functionality. I want to press
> a key (for instance: the '8' key) and emacs writte the symbol that
> result of typing Shift+key  (for instance: the '(' symbol ).
>
> But I want to be able to writte numbers with the numeric keyboard.
>
> To the moment I have not esitate so when I change the key '8' (for
> instance) the other '8' key (from the numeric keyboard) is changed
> too.
>
> Does someone of you have the answer?
>
> Thanks so much.
>
> César BCN
> cesarTMP (AT) gmail (DOT) com



reply via email to

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