From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Delegating key actions
Date: Sun, 16 May 2010 23:49:24 +0200 [thread overview]
Message-ID: <877hn3qzyz.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: mailman.2.1273975665.25571.help-gnu-emacs@gnu.org
Karan Bathla <karan_goku@yahoo.com> writes:
> I would like to be able to use n,p,j,; as down,up,left,right
> respectively upon invocation of a function/minor-mode. Is there
> already some package that does something like this?
If it was hjkl, there would be viper-mode.
(defun* backward-line (&optional (x 1))
(interactive)
(forward-line (- x)))
(defun my-movement-keys (off)
(interactive "P")
(let ((bindings '(("n" forward-line)
("p" backward-line)
("j" backward-char)
(";" forward-char))))
(loop for (key fun) in bindings
do (local-set-key (read-kbd-macro key)
(if off
(function self-insert-command)
fun)))))
> I want to delegate all keystrokes i.e. "C-n" and "M-n" would do
> "C-<down>" and "M-<down>" whatever function that keystroke corresponds
> to in the buffer.
Have a look at keyboard-translate
--
__Pascal Bourguignon__ http://www.informatimago.com/
next parent reply other threads:[~2010-05-16 21:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.2.1273975665.25571.help-gnu-emacs@gnu.org>
2010-05-16 21:49 ` Pascal J. Bourguignon [this message]
2010-05-15 21:15 Delegating key actions Karan Bathla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877hn3qzyz.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.