2022 Developer Survey is open! Take survey.

Questions tagged [events]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
32 views

`read-event`: How to cancel a mouse event once read

Q: read-event: How to cancel a mouse event once read? As to a generic keyboard keystroke, read-event reads the event without executing the command that the key is bound to. E.g., calling read-event ...
user avatar
  • 17.6k
1 vote
1 answer
23 views

Sample code for events management

I'd like to write a simple loop that catches and prints the incoming event while the script is running. I've tried this: (let ((key 0)) (while (= key 0) (setq event (read-...
user avatar
1 vote
0 answers
30 views

On installing a handler for SIGUSR1

The documentation quoted in this answer mentions two different way of installing a handler for a SIGUSR1 signal, namely: (define-key special-event-map [sigusr1] 'sigusr1-handler) and (global-set-key [...
user avatar
  • 2,889
0 votes
0 answers
80 views

Make Org-Agenda and Orgzly show repeated events?

Motivation I want to organize my whole life with org-mode. In particular, I want my org-agenda to remind me when I need to work, since I have weird working times. My approach My approach was to create ...
user avatar
2 votes
1 answer
45 views

How to make the mouse only change point only when clicked in the same window?

I want to change the mouse behaviour in Emacs: When I click between windows (i.e. from one window into another)), I only want to select the new window and not change point. This is the behaviour ...
user avatar
  • 1,041
1 vote
1 answer
111 views

tooltip-functions not working?

Years ago, when Emacs was at 21.*, I had a function that displayed a tooltip when I hovered the mouse on certain words in the buffer. Now, in 26.3, I want to use that function again, but it does not ...
user avatar
  • 161
1 vote
1 answer
46 views

unread-command-events and batch mode

I'm writing tests for an interactive function. I've been using the unread-command-events variable in conjunction with call-interactively to verify that it does the right thing. However, I just ...
user avatar
  • 5,735
1 vote
1 answer
121 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 ...
user avatar
  • 7,069
0 votes
1 answer
33 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 ...
user avatar
  • 85
0 votes
1 answer
202 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 ...
user avatar
  • 463
1 vote
1 answer
35 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 ...
user avatar
  • 5,735
3 votes
1 answer
197 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-...
user avatar
  • 6,661
2 votes
1 answer
381 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" (...
user avatar
  • 479
0 votes
1 answer
147 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-...
user avatar
1 vote
1 answer
122 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-...
user avatar
1 vote
1 answer
280 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 ...
user avatar
  • 1,466
7 votes
2 answers
632 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 ...
user avatar
  • 2,889
6 votes
3 answers
116 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. ...
user avatar
5 votes
1 answer
668 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 ...
user avatar
  • 10.8k
1 vote
1 answer
386 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 ...
user avatar
  • 768
1 vote
0 answers
56 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 ...
user avatar
1 vote
1 answer
96 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 ...
user avatar
  • 2,055
2 votes
0 answers
43 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 ...
user avatar
9 votes
2 answers
388 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 ...
user avatar
3 votes
1 answer
220 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 ...
user avatar
  • 61
4 votes
1 answer
209 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 ...
user avatar
  • 6,661
1 vote
1 answer
235 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 ...
user avatar
  • 235
30 votes
4 answers
7k 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 ...
user avatar
  • 7,763