Questions tagged [events]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
93 views

How to access mouse event coordinates? (conveniently)

When getting events from (read-event) it's possible to access only mouse events using (mouse-movement-p event). Inspecting the events I've found I can get the Y pixel location using (cdr (nth 2 (nth ...
0
votes
1answer
25 views

How to count the number of clocks of some given duration?

I want to collect statistics about some clocked events; more specifically I need to count the number of clocked events (belonging to some subtree for instance) whose duration is in some predefined ...
0
votes
1answer
108 views

mode-line refresh with alerts and weechat

Note - The original post incorrectly diagnosed this as a terminal issue. Further testing showed this not to be the case - the issue is a race condition in the alert package. I've crossed-out the now ...
1
vote
1answer
27 views

Remap input event in all contexts

I'm currently trying to implement a virtual keyboard. For this to work I need to remap input events in all contexts. I'm aware of the variables function-key-map and it's siblings, as well as input ...
3
votes
1answer
142 views

Process unread-command-events and redisplay

(defun pretend (keys) (dolist (e (reverse (listify-key-sequence (kbd keys)))) (push e unread-command-events) ;; (mystery-function) (redisplay t) (sleep-for 0.1))) (pretend "M-x my-...
1
vote
1answer
187 views

How to use unread-command-events variable?

I want to generate some input from my command programmatically. I have tried using unread-command-events variable for that, see: (defun unread_test () "Repeat input after toggling input method" (...
0
votes
1answer
77 views

file-notify-add-watch : get file path string

I would to do a specific action (create an org-mod link) when a new file appears in a given directory. For that I need to catch the event but also the path of the new file. I managed to use file-...
1
vote
1answer
72 views

Wait for release a key to go on in a loop

I have this loop: (catch 'QUIT (while (search-forward-regexp "\\([^\n\\]\\(?:\\\\\\\\\\)*\\|^\\(?:\\\\\\\\\\)+\\)%.*\n" nil t) (save-excursion (let ((b (make-...
1
vote
1answer
153 views

elisp - detect line change event to trigger function

I want to detect line change event (arrow-,arrow- or mouse click) to trigger my function call. Below example handled arrow- arrow- but can not handle mouse click or C-n C-p line change event. (defun ...
7
votes
2answers
540 views

Looking for something like a `first-keypress-in-a-while-hook`

Suppose that I have an Emacs session running, and that I step away from my computer for, say, 20 minutes. Upon returning to my Emacs session, at some point I will press some key while the Emacs ...
6
votes
3answers
93 views

How to detect if `read-event` or `y-or-n-p` is running?

In haskell-doc-mode we have a timer that shows useful tips in minibuffer when cursor is idle for a moment. In other part of Haskell Mode there is code asking questions using y-or-n-p or read-event. ...
5
votes
1answer
427 views

Send input to multiple buffers simultaneously

Is there something like multiple-cursors, but that would send input into multiple buffers at once? Use case: I want to send the same shell commands to a number of virtual machines and see the output ...
1
vote
1answer
250 views

Help with my double tap key-binding function

I'm writing a function to enable binding a "double tap" on a key (or one key then another key in rapid succession) to a function. It almost works, but not quite. Here is the code I have in my lisp ...
1
vote
0answers
44 views

read-event read entire arrow key instead of escape

In graphical emacs on OS X, (read-event) in the scratch buffer produces left, however in iterm2 (which I configured to send esc-* for arrow keys), I get something like (read-event) 27 OD when I ...
1
vote
1answer
63 views

How to get the string representation of a keymap event?

I'd like to get the string representation of a keymap event. For instance 19 should be printed as C-s, 1 as C-a etc... I could make my own function to do that but since describe-keyis capable of ...
2
votes
0answers
37 views

Control or set the emacs mouse button event polling rate?

I have been using artist-mode and noticed that even at moderate mouse movement speeds the mouse event polling rate (here for down-mouse-1) does not seem to keep up (so lines end up with scattered ...
8
votes
2answers
260 views

Translating strings to keypresses

Given a string in elisp, I'd like to simulate emacs receiving whatever keypresses are necessary to re-create that string. So given the string "Hello" emacs would act exactly the same as if I had ...
3
votes
1answer
170 views

Making read-char input robust? [closed]

I need to read a char at a time to interactively build a filter string while I show the results in a regular buffer. And what I've written works, except when a cursor key is pressed - then bang, I ...
4
votes
1answer
121 views

How can I convert a C-key code into a 'normal' key code?

Background With jumping packages like Ace and Avy, you can start a function, provide a query char, and then jump to somewhere based on further input. (Lately I've preferred Avy, but that's irrelevant ...
1
vote
1answer
178 views

How to move point with mousepointer on shift-click in emacs

I want to write some functionality that fires whenever I shift-click a point in an emacs buffer. Problem is that when shift is pressed, the point is not changing when clicking. To make things more ...
26
votes
4answers
5k views

How can I simulate an arbitary key event from Elisp?

Is it possible to simulate an arbitrary key event from elisp? I am aware of ways that I can find the binding for a given key, and then call that command interactively, but what if that key event is ...