Questions tagged [events]
The events tag has no usage guidance.
36 questions
0
votes
1
answer
82
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 (...
2
votes
2
answers
95
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 &...
3
votes
2
answers
180
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> ...
2
votes
0
answers
48
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 ...
1
vote
1
answer
68
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. ...
0
votes
1
answer
334
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 ...
4
votes
1
answer
116
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 ...
3
votes
1
answer
99
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' ...
0
votes
1
answer
66
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 ...
2
votes
1
answer
60
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-...
2
votes
1
answer
66
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 [...
0
votes
0
answers
235
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 ...
2
votes
2
answers
155
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 ...
1
vote
1
answer
238
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 ...
1
vote
1
answer
68
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 ...
1
vote
1
answer
143
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
1
answer
38
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
1
answer
231
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
1
answer
39
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 ...
4
votes
1
answer
254
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-...
2
votes
1
answer
558
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
1
answer
195
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
1
answer
196
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
1
answer
318
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
2
answers
707
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
3
answers
122
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
1
answer
832
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
1
answer
475
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
0
answers
65
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 ...
2
votes
1
answer
142
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
0
answers
48
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 ...
9
votes
2
answers
483
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
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 ...
4
votes
1
answer
301
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
1
answer
275
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 ...
34
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 ...