* in which keymap to set SIGUSR-handler
@ 2023-08-27 16:54 Shynur Xie
2023-08-27 17:59 ` Eli Zaretskii
2023-08-27 21:44 ` Emanuel Berg
0 siblings, 2 replies; 5+ messages in thread
From: Shynur Xie @ 2023-08-27 16:54 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Hi, friends. I'm reading the elisp manual. In 22.7.12 Miscellaneous
System Events
(<https://gnu.org/s/emacs/manual/html_node/elisp/Misc-Events.html>),
there's a sample code about SIGUSR:
(keymap-set special-event-map "<sigusr1>" 'sigusr-handler)
In 22.7.13 Event Examples
(<https://gnu.org/s/emacs/manual/html_node/elisp/Event-Examples.html>)
there's another one:
(keymap-global-set "<signal> <usr1>" 'usr1-handler)
Which one should I use in my init file? Thanks in advance.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: in which keymap to set SIGUSR-handler
2023-08-27 16:54 Shynur Xie
@ 2023-08-27 17:59 ` Eli Zaretskii
2023-08-27 21:44 ` Emanuel Berg
1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-08-27 17:59 UTC (permalink / raw)
To: help-gnu-emacs
> From: Shynur Xie <one.last.kiss@outlook.com>
> Date: Sun, 27 Aug 2023 16:54:25 +0000
> msip_labels:
>
> Hi, friends. I'm reading the elisp manual. In 22.7.12 Miscellaneous
> System Events
> (<https://gnu.org/s/emacs/manual/html_node/elisp/Misc-Events.html>),
> there's a sample code about SIGUSR:
>
> (keymap-set special-event-map "<sigusr1>" 'sigusr-handler)
>
> In 22.7.13 Event Examples
> (<https://gnu.org/s/emacs/manual/html_node/elisp/Event-Examples.html>)
> there's another one:
>
> (keymap-global-set "<signal> <usr1>" 'usr1-handler)
>
> Which one should I use in my init file? Thanks in advance.
They should both work. Did you try?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: in which keymap to set SIGUSR-handler
@ 2023-08-27 18:18 Shynur Xie
2023-08-27 18:50 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Shynur Xie @ 2023-08-27 18:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs@gnu.org
The second one doesn't work:
(keymap-global-set "<signal> <usr1>"
(lambda ()
(interactive)
(message "-*-*-*-")))
(signal-process (emacs-pid) 'sigusr1)
Am I missing something?
emacs-version: 30.0.50
system-configuration: x86_64-pc-linux-gnu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: in which keymap to set SIGUSR-handler
2023-08-27 18:18 in which keymap to set SIGUSR-handler Shynur Xie
@ 2023-08-27 18:50 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-08-27 18:50 UTC (permalink / raw)
To: help-gnu-emacs
> From: Shynur Xie <one.last.kiss@outlook.com>
> CC: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> Date: Sun, 27 Aug 2023 18:18:37 +0000
>
> The second one doesn't work:
>
> (keymap-global-set "<signal> <usr1>"
> (lambda ()
> (interactive)
> (message "-*-*-*-")))
> (signal-process (emacs-pid) 'sigusr1)
>
> Am I missing something?
If you are sure you did everything right, submit a bug report.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: in which keymap to set SIGUSR-handler
2023-08-27 16:54 Shynur Xie
2023-08-27 17:59 ` Eli Zaretskii
@ 2023-08-27 21:44 ` Emanuel Berg
1 sibling, 0 replies; 5+ messages in thread
From: Emanuel Berg @ 2023-08-27 21:44 UTC (permalink / raw)
To: help-gnu-emacs
Shynur Xie wrote:
> (keymap-global-set "<signal> <usr1>" 'usr1-handler)
>
> Which one should I use in my init file? Thanks in advance.
Try this:
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/signal.el
;;
;; test from Emacs:
;; (signal-process (emacs-pid) 'sigusr1)
;;
;; test from zsh:
;; $ kill -s usr1 $(pidof emacs)
(defun signal-usr1-f ()
(interactive)
(message "USR1 signal") )
(define-key special-event-map [sigusr1] #'signal-usr1-f)
(provide 'signal)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-27 21:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-27 18:18 in which keymap to set SIGUSR-handler Shynur Xie
2023-08-27 18:50 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2023-08-27 16:54 Shynur Xie
2023-08-27 17:59 ` Eli Zaretskii
2023-08-27 21:44 ` Emanuel Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).