[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to bind the same function to different keys with different behaviour
From: |
sokobania . 01 |
Subject: |
How to bind the same function to different keys with different behaviours? |
Date: |
Wed, 13 Jan 2016 04:55:40 -0800 (PST) |
User-agent: |
G2/1.0 |
In the basic modemap, the ascii keys are bound to `self-insert-command'.
As it is not an emacs-lisp function, I cannot "copy" its code.
I want to bind the keys [A-Z] to `my-self-insert-command' with something like:
(for key from ?A to ?Z do
(bind-key my-mode-map key 'my-self-insert-command))
This function kind of inserts the current key pressed under some conditions.
So far, I don't know how to get acces to the current key pressed from within
`my-self-insert-command'.
Is this possible?
If it is not possible, I'll do something like:
(for key from ?A to ?Z do
(bind-key my-mode-map key (lambda () (my-self-insert-command key))))
- How to bind the same function to different keys with different behaviours?,
sokobania . 01 <=