* Emacs attach an action to any key pressed
@ 2013-06-05 5:26 Ivanov Dmitry
2013-06-05 6:44 ` Magnar Sveen
2013-06-05 13:02 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: Ivanov Dmitry @ 2013-06-05 5:26 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 362 bytes --]
Suppose, I have the code:
(defun dummy ()
(interactive)
(message "aaa"))
(local-set-key (kbd "<left>") 'dummy)
When you click <left> key in the current buffer, it will print "aaa".
Is it possible to attach this action to any key pressed?
I looked into "Format of Keymaps" and "Searching Keymaps" in Emacs info
pages, but found no code examples.
[-- Attachment #2: Type: text/html, Size: 525 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs attach an action to any key pressed
2013-06-05 5:26 Emacs attach an action to any key pressed Ivanov Dmitry
@ 2013-06-05 6:44 ` Magnar Sveen
2013-06-05 7:56 ` Ivanov Dmitry
2013-06-05 13:02 ` Stefan Monnier
1 sibling, 1 reply; 6+ messages in thread
From: Magnar Sveen @ 2013-06-05 6:44 UTC (permalink / raw)
To: Ivanov Dmitry; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 526 bytes --]
Sounds like you're looking for the post-command-hook.
- Magnar
On Wed, Jun 5, 2013 at 7:26 AM, Ivanov Dmitry <usr345@gmail.com> wrote:
> Suppose, I have the code:
>
> (defun dummy ()
> (interactive)
> (message "aaa"))
>
> (local-set-key (kbd "<left>") 'dummy)
>
> When you click <left> key in the current buffer, it will print "aaa".
>
> Is it possible to attach this action to any key pressed?
>
> I looked into "Format of Keymaps" and "Searching Keymaps" in Emacs info
> pages, but found no code examples.
>
[-- Attachment #2: Type: text/html, Size: 995 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Emacs attach an action to any key pressed
2013-06-05 5:26 Emacs attach an action to any key pressed Ivanov Dmitry
2013-06-05 6:44 ` Magnar Sveen
@ 2013-06-05 13:02 ` Stefan Monnier
2013-06-05 13:48 ` Ivanov Dmitry
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-06-05 13:02 UTC (permalink / raw)
To: Ivanov Dmitry; +Cc: emacs-devel
> Is it possible to attach this action to any key pressed?
Maybe you're looking for
(local-set-key [t] 'dummy)
-- Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-05 13:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 5:26 Emacs attach an action to any key pressed Ivanov Dmitry
2013-06-05 6:44 ` Magnar Sveen
2013-06-05 7:56 ` Ivanov Dmitry
2013-06-05 13:24 ` Kevin Rodgers
2013-06-05 13:02 ` Stefan Monnier
2013-06-05 13:48 ` Ivanov Dmitry
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).