aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2006-12-19 15:38:08 +0000
committerKim F. Storm2006-12-19 15:38:08 +0000
commitf68903b317e0bbddd03b8e2da1e9afedb2afeb47 (patch)
treea62eadd0c40a0cd7497819936efecdf547f44fa9
parent6a7d16fe7a567cb815c915c8e056bce4dab7ef9f (diff)
downloademacs-f68903b317e0bbddd03b8e2da1e9afedb2afeb47.tar.gz
emacs-f68903b317e0bbddd03b8e2da1e9afedb2afeb47.zip
(Misc Events): User signals now result in sigusr1
and sigusr2 events which are handled through special-event-map. (Special Events): User signals and drag-n-drop are special.
-rw-r--r--lispref/commands.texi34
1 files changed, 27 insertions, 7 deletions
diff --git a/lispref/commands.texi b/lispref/commands.texi
index 7188961e344..0f45ddbdd04 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -1586,14 +1586,33 @@ The precise meaning of the event parameters and the way these
1586parameters are used to display the help-echo text are described in 1586parameters are used to display the help-echo text are described in
1587@ref{Text help-echo}. 1587@ref{Text help-echo}.
1588 1588
1589@cindex @code{signal usr1} event 1589@cindex @code{sigusr1} event
1590@cindex @code{signal usr2} event 1590@cindex @code{sigusr2} event
1591@cindex user signals 1591@cindex user signals
1592@item signal usr1 1592@item sigusr1
1593@itemx signal usr2 1593@itemx sigusr2
1594These event sequences are generated when the Emacs process receives 1594These events are generated when the Emacs process receives
1595the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no 1595the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no
1596additional data because signals do not carry additional information. 1596additional data because signals do not carry additional information.
1597
1598To catch a user signal, bind the corresponding event to an interactive
1599command in the @code{special-event-map} (@pxref{Active Keymaps}).
1600The command is called with no arguments, and the specific signal event is
1601available in @code{last-input-event}. For example:
1602
1603@example
1604(defun sigusr-handler ()
1605 (interactive)
1606 (message "Caught signal %S" last-input-event))
1607
1608(define-key special-event-map [sigusr1] 'sigusr-handler)
1609@end example
1610
1611To test the signal handler, you can make Emacs send a signal to itself:
1612
1613@example
1614(signal-process (emacs-pid) 'sigusr1)
1615@end example
1597@end table 1616@end table
1598 1617
1599 If one of these events arrives in the middle of a key sequence---that 1618 If one of these events arrives in the middle of a key sequence---that
@@ -2634,8 +2653,9 @@ These events do, however, appear in @code{last-input-event} immediately
2634after they are read, and this is the way for the event's definition to 2653after they are read, and this is the way for the event's definition to
2635find the actual event. 2654find the actual event.
2636 2655
2637The events types @code{iconify-frame}, @code{make-frame-visible} and 2656The events types @code{iconify-frame}, @code{make-frame-visible},
2638@code{delete-frame} are normally handled in this way. The keymap which 2657@code{delete-frame}, @code{drag-n-drop}, and user signals like
2658@code{sigusr1} are normally handled in this way. The keymap which
2639defines how to handle special events---and which events are special---is 2659defines how to handle special events---and which events are special---is
2640in the variable @code{special-event-map} (@pxref{Active Keymaps}). 2660in the variable @code{special-event-map} (@pxref{Active Keymaps}).
2641 2661