all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How can I change the keys?
@ 2008-04-10 22:15 Cesar_BCN
  2008-04-10 22:53 ` weber
  2008-04-11 19:50 ` Xah Lee
  0 siblings, 2 replies; 5+ messages in thread
From: Cesar_BCN @ 2008-04-10 22:15 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

* Re: How can I change the keys?
  2008-04-10 22:15 How can I change the keys? Cesar_BCN
@ 2008-04-10 22:53 ` weber
  2008-04-11 19:50 ` Xah Lee
  1 sibling, 0 replies; 5+ messages in thread
From: weber @ 2008-04-10 22:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Apr 10, 7: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

First section:

http://www.zafar.se/bkz/Articles/EmacsTips

Cheers


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

* Re: How can I change the keys?
  2008-04-10 22:15 How can I change the keys? Cesar_BCN
  2008-04-10 22:53 ` weber
@ 2008-04-11 19:50 ` Xah Lee
  2008-04-12  5:13   ` Timothy Hobbs
       [not found]   ` <mailman.10288.1207977249.18990.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 5+ messages in thread
From: Xah Lee @ 2008-04-11 19:50 UTC (permalink / raw)
  To: help-gnu-emacs

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



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

* Re: How can I change the keys?
  2008-04-11 19:50 ` Xah Lee
@ 2008-04-12  5:13   ` Timothy Hobbs
       [not found]   ` <mailman.10288.1207977249.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Timothy Hobbs @ 2008-04-12  5:13 UTC (permalink / raw)
  To: EMACS list

I do not know about Macs, but in both windows and X11, remapping of the keyboard is easy, and safe.  With windows, I suggest http://www.randyrants.com/2006/07/sharpkeys_211.html which, as of a few years ago worked like a charm(my dad's even used it on vista, though only for the CAPS-LOCK/SHIFT switch.  xmodmap is also possible to use, though it has some definite complications.  xmodmap has the advantage that in my suggested method, you will be able to press shift-1 and get 1, while 1 will give you ! .  Here is how I suggest doing this project.

1. Get a piece of paper(ya, like the white crinkly stuff you make spitballs with).

2. Get a pencil or pen, or prick yourself with a needle, or some other writing utensil.

3. Open up a terminal emulator in a window manager that's sane.

4. Type 'xev'.

5. Type '1', write down the KEYCODE(for '1' this is 10), that xev printed into the terminal emulator window, onto your piece of paper.  Now press shift-1, and write down the KEYSYM on your sheet, for shift-1 this is exclam.

REPEAT for all numbers.

6. Kill the xev window.

7. Type "cd ~/; nano .xmodmap-numbershifter RET" into the terminal emulator window.

8. Type "keycode KEYCODE = KEYSYM NUMBER RET" into your terminal emulator window.

EXAMPLE: keycode 10 = exclam 1

REPEAT for the rest of your keys.

9. Save the file in nano.

10. Type xmodmap .xmodmap-numbershifter

11. Press some numbers on both the top and the keypad, using shift on the top as well to test it.

12. Type "nano .xsession RET"

13. Type "xmodmap /home/NAME/.xmodmap-numbershifter RET"

14. Restart X

15. Repeat step 11

OPTIONAL

16. If the key mappings went away... You should try steps 12 and 13 on .xinitrc instead of .xsession...

Hope this helps.

Timothy




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

* Re: How can I change the keys?
       [not found]   ` <mailman.10288.1207977249.18990.help-gnu-emacs@gnu.org>
@ 2008-04-12  9:13     ` Rupert Swarbrick
  0 siblings, 0 replies; 5+ messages in thread
From: Rupert Swarbrick @ 2008-04-12  9:13 UTC (permalink / raw)
  To: help-gnu-emacs


Using nano!!?

Rupert


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

end of thread, other threads:[~2008-04-12  9:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10 22:15 How can I change the keys? Cesar_BCN
2008-04-10 22:53 ` weber
2008-04-11 19:50 ` Xah Lee
2008-04-12  5:13   ` Timothy Hobbs
     [not found]   ` <mailman.10288.1207977249.18990.help-gnu-emacs@gnu.org>
2008-04-12  9:13     ` Rupert Swarbrick

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.