Questions tagged [events]

The tag has no usage guidance.

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

query-replace: ignore events not binded in query-replace-map

I have this function: (defun my-replacements () (interactive) (query-replace "foo" "bar" nil (point-min) (point-max)) (query-replace "baz" "quz" nil (...
Gabriele's user avatar
  • 1,554
2 votes
2 answers
64 views

Make "M-x repeat" Ignore Movement Commands

Is there a standard way to make M-x repeat ignore movement commands or does it require custom elisp? I read a [Mastering Emacs blog post about repeating commands][1] and immediately started using &...
nslamberth's user avatar
3 votes
2 answers
169 views

input event <nil>

I don't know what I did caused Emacs to emit such a message: <nil> <wheel-down> is undefined Screenshot: How did I issue this input event? In other words, what does this <nil> ...
shynur's user avatar
  • 5,288
2 votes
0 answers
42 views

Inconsistency between read-key and read-key-sequence-vector w.r.t. conditional application of local-function-key-map translations

While working with read-key-sequence-vector and read-key, I found that the former applies the local-function-key-map translations in a conditional manner but the latter does not. I am using Emacs 28.1 ...
Susam Pal's user avatar
  • 186
1 vote
1 answer
56 views

`define-key` redefines behavior of slow mouse click, but not fast mouse click

The problem in brief I want to redefine what clicking (on an org link) does. My code works, if I click slowly enough, but for a normal (fast) click it does not -- instead I get the default behavior. ...
Jeffrey Benjamin Brown's user avatar
0 votes
1 answer
211 views

Understanding of Emacs way of managing user input events

As an Emacs newbie (with two weeks of Emacs experience) I am in the process of understanding the way Emacs manages user input events. My current understanding of how it works is that the way Emacs ...
Claudio's user avatar
  • 450
4 votes
1 answer
82 views

Isearch + Dired fast navigation

After seeing this post and one of its comments, I am trying to implement the following convenient search pattern in dired: Press C-s to start isearch Type the substring I am looking for Possibly jump ...
unvarnished's user avatar
3 votes
1 answer
86 views

Is there a reliable way read an existing event, if any, and remove it from the queue with zero delay?

An answer to another question suggests that supplying a timeout of 0.0 to read-event (as the optional SECONDS parameter) will always return nil immediately, and, if I'm reading the code in Emacs' ...
user avatar
0 votes
1 answer
56 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 ...
lawlist's user avatar
  • 19.1k
1 vote
1 answer
54 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-...
Quasar999's user avatar
2 votes
1 answer
58 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 [...
kjo's user avatar
  • 3,247
0 votes
0 answers
209 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 ...
Mekeor Melire's user avatar
2 votes
2 answers
127 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 ...
halloleo's user avatar
  • 1,341
1 vote
1 answer
208 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 ...
toomas's user avatar
  • 183
1 vote
1 answer
61 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 ...
Lindydancer's user avatar
  • 6,160
1 vote
1 answer
140 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 ...
ideasman42's user avatar
  • 8,796
0 votes
1 answer
36 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 ...
Wilder's user avatar
  • 95
0 votes
1 answer
224 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 ...
Phil's user avatar
  • 535
1 vote
1 answer
38 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 ...
Lindydancer's user avatar
  • 6,160
4 votes
1 answer
239 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-...
Sean Allred's user avatar
  • 6,921
2 votes
1 answer
512 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" (...
Srv19's user avatar
  • 489
0 votes
1 answer
184 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-...
Bertrand Simon's user avatar
1 vote
1 answer
171 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-...
Gabriele's user avatar
  • 1,554
1 vote
1 answer
316 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 ...
lucky1928's user avatar
  • 1,666
7 votes
2 answers
691 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 ...
kjo's user avatar
  • 3,247
6 votes
3 answers
121 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. ...
Gracjan Polak's user avatar
5 votes
1 answer
789 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 ...
wvxvw's user avatar
  • 11.4k
1 vote
1 answer
463 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 ...
Zorgoth's user avatar
  • 840
1 vote
0 answers
64 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 ...
Greg Nisbet's user avatar
2 votes
1 answer
134 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 ...
syl20bnr's user avatar
  • 2,095
2 votes
0 answers
46 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 ...
Bauta Steen's user avatar
9 votes
2 answers
459 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 ...
Joseph Garvin's user avatar
3 votes
1 answer
235 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 ...
ump's user avatar
  • 61
4 votes
1 answer
283 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 ...
Sean Allred's user avatar
  • 6,921
1 vote
1 answer
271 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 ...
Peter's user avatar
  • 245
33 votes
4 answers
8k 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 ...
nispio's user avatar
  • 8,225