help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Capture ALL keystrokes


From: Ben Forbes
Subject: Re: Capture ALL keystrokes
Date: Fri, 30 May 2008 21:21:01 +1000

> (defun my-command ()
> "After key A, key B executes the command newline repeatedly"
>  (interactive)
>  (insert "A")
>  (while (equal (setq key (read-event)) ?B)
>      (next-line))
>  (push key unread-command-events))
>
> (global-set-key "A" 'my-command)
>

That approach works quite well, thanks. My goal was to be able to call
emms-random with a single keystroke when the initial call required two
keystrokes. This is because I've put all my emms keystrokes after
C-H-s-c to keep them organized. Now I can hit C-H-s-c C-H-s-r to call
emms-random once, and every time I hit C-H-s-r after that, it calls
emms-random again. It's a bit frivolous I guess, but it was more about
learning emacs programming than anything else. Thanks for the help
everyone.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]