diff options
| author | Kim F. Storm | 2006-12-19 15:38:08 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-12-19 15:38:08 +0000 |
| commit | f68903b317e0bbddd03b8e2da1e9afedb2afeb47 (patch) | |
| tree | a62eadd0c40a0cd7497819936efecdf547f44fa9 | |
| parent | 6a7d16fe7a567cb815c915c8e056bce4dab7ef9f (diff) | |
| download | emacs-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.texi | 34 |
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 | |||
| 1586 | parameters are used to display the help-echo text are described in | 1586 | parameters 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 |
| 1594 | These event sequences are generated when the Emacs process receives | 1594 | These events are generated when the Emacs process receives |
| 1595 | the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no | 1595 | the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no |
| 1596 | additional data because signals do not carry additional information. | 1596 | additional data because signals do not carry additional information. |
| 1597 | |||
| 1598 | To catch a user signal, bind the corresponding event to an interactive | ||
| 1599 | command in the @code{special-event-map} (@pxref{Active Keymaps}). | ||
| 1600 | The command is called with no arguments, and the specific signal event is | ||
| 1601 | available 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 | |||
| 1611 | To 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 | |||
| 2634 | after they are read, and this is the way for the event's definition to | 2653 | after they are read, and this is the way for the event's definition to |
| 2635 | find the actual event. | 2654 | find the actual event. |
| 2636 | 2655 | ||
| 2637 | The events types @code{iconify-frame}, @code{make-frame-visible} and | 2656 | The 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 | ||
| 2639 | defines how to handle special events---and which events are special---is | 2659 | defines how to handle special events---and which events are special---is |
| 2640 | in the variable @code{special-event-map} (@pxref{Active Keymaps}). | 2660 | in the variable @code{special-event-map} (@pxref{Active Keymaps}). |
| 2641 | 2661 | ||