all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* binding "<escape> <kp-delete>"
@ 2013-06-05 23:57 Maverick Woo
  2013-06-06  0:46 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Maverick Woo @ 2013-06-05 23:57 UTC (permalink / raw
  To: help-gnu-emacs

This is Emacs 24.3 on OSX GUI.

The default installation maps kp-delete to 4 (C-d) in local-function-key-map. This works as intended. But if I press "<escape> <kp-delete>", it gets translated into "C-M-d", which is down-list for me. Instead, I want it to do a forward kill word.

The problem comes when I try to bind "<escape> <kp-delete>". The farthest I got is as follows, but it has a significant drawback:

1. erase it in local-function-key-map first:
(define-key local-function-key-map (kbd "<kp-delete>") nil)

2. to get back the no-modifier behavior, this works:
(global-set-key (kbd "<kp-delete>") 'delete-char)

3. suppose delete-word is the function I want to bind to:
(global-set-key (kbd "<escape> <kp-delete>") 'delete-word)

The problem with this method is I break the "<escape> ==> meta" translation. In particular, after step 3, the other keys like "<escape> x" will not get translated into M-x any more. So I think step 3 should not be done.

Any hint on how to bind "<escape><kp-delete>" properly?

Thanks.


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

* Re: binding "<escape> <kp-delete>"
  2013-06-05 23:57 binding "<escape> <kp-delete>" Maverick Woo
@ 2013-06-06  0:46 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-06-06  0:46 UTC (permalink / raw
  To: help-gnu-emacs

> 3. suppose delete-word is the function I want to bind to:
> (global-set-key (kbd "<escape> <kp-delete>") 'delete-word)

I think you want

   (global-set-key [?\e kp-delete] 'delete-word)

instead.  IOW, the problem is not the "escape -> meta" mapping but the
"escape -> ESC" mapping.


        Stefan




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

end of thread, other threads:[~2013-06-06  0:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 23:57 binding "<escape> <kp-delete>" Maverick Woo
2013-06-06  0:46 ` Stefan Monnier

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.