diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/misc-events.html | |
new repository
Diffstat (limited to 'devdocs/elisp/misc-events.html')
| -rw-r--r-- | devdocs/elisp/misc-events.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/devdocs/elisp/misc-events.html b/devdocs/elisp/misc-events.html new file mode 100644 index 00000000..5edea0fb --- /dev/null +++ b/devdocs/elisp/misc-events.html @@ -0,0 +1,34 @@ + <h4 class="subsection">Miscellaneous System Events</h4> <p>A few other event types represent occurrences within the system. </p> <dl compact> <dt><code>(delete-frame (<var>frame</var>))</code></dt> <dd> +<p>This kind of event indicates that the user gave the window manager a command to delete a particular window, which happens to be an Emacs frame. </p> <p>The standard definition of the <code>delete-frame</code> event is to delete <var>frame</var>. </p> </dd> <dt><code>(iconify-frame (<var>frame</var>))</code></dt> <dd> +<p>This kind of event indicates that the user iconified <var>frame</var> using the window manager. Its standard definition is <code>ignore</code>; since the frame has already been iconified, Emacs has no work to do. The purpose of this event type is so that you can keep track of such events if you want to. </p> </dd> <dt><code>(make-frame-visible (<var>frame</var>))</code></dt> <dd> +<p>This kind of event indicates that the user deiconified <var>frame</var> using the window manager. Its standard definition is <code>ignore</code>; since the frame has already been made visible, Emacs has no work to do. </p> </dd> <dt><code>(wheel-up <var>position</var>)</code></dt> <dt><code>(wheel-down <var>position</var>)</code></dt> <dd> +<p>These kinds of event are generated by moving a mouse wheel. The <var>position</var> element is a mouse position list (see <a href="click-events">Click Events</a>), specifying the position of the mouse cursor when the event occurred. </p> <p>This kind of event is generated only on some kinds of systems. On some systems, <code>mouse-4</code> and <code>mouse-5</code> are used instead. For portable code, use the variables <code>mouse-wheel-up-event</code> and <code>mouse-wheel-down-event</code> defined in <samp>mwheel.el</samp> to determine what event types to expect for the mouse wheel. </p> </dd> <dt><code>(drag-n-drop <var>position</var> <var>files</var>)</code></dt> <dd> +<p>This kind of event is generated when a group of files is selected in an application outside of Emacs, and then dragged and dropped onto an Emacs frame. </p> <p>The element <var>position</var> is a list describing the position of the event, in the same format as used in a mouse-click event (see <a href="click-events">Click Events</a>), and <var>files</var> is the list of file names that were dragged and dropped. The usual way to handle this event is by visiting these files. </p> <p>This kind of event is generated, at present, only on some kinds of systems. </p> </dd> <dt><code>help-echo</code></dt> <dd> +<p>This kind of event is generated when a mouse pointer moves onto a portion of buffer text which has a <code>help-echo</code> text property. The generated event has this form: </p> <div class="example"> <pre class="example">(help-echo <var>frame</var> <var>help</var> <var>window</var> <var>object</var> <var>pos</var>) +</pre> +</div> <p>The precise meaning of the event parameters and the way these parameters are used to display the help-echo text are described in <a href="special-properties#Text-help_002decho">Text help-echo</a>. </p> </dd> <dt><code>sigusr1</code></dt> <dt><code>sigusr2</code></dt> <dd> +<p>These events are generated when the Emacs process receives the signals <code>SIGUSR1</code> and <code>SIGUSR2</code>. They contain no additional data because signals do not carry additional information. They can be useful for debugging (see <a href="error-debugging">Error Debugging</a>). </p> <p>To catch a user signal, bind the corresponding event to an interactive command in the <code>special-event-map</code> (see <a href="controlling-active-maps">Controlling Active Maps</a>). The command is called with no arguments, and the specific signal event is available in <code>last-input-event</code> (see <a href="event-input-misc">Event Input Misc</a>. For example: </p> <div class="example"> <pre class="example">(defun sigusr-handler () + (interactive) + (message "Caught signal %S" last-input-event)) + +(define-key special-event-map [sigusr1] 'sigusr-handler) +</pre> +</div> <p>To test the signal handler, you can make Emacs send a signal to itself: </p> <div class="example"> <pre class="example">(signal-process (emacs-pid) 'sigusr1) +</pre> +</div> </dd> <dt><code>language-change</code></dt> <dd> +<p>This kind of event is generated on MS-Windows when the input language has changed. This typically means that the keyboard keys will send to Emacs characters from a different language. The generated event has this form: </p> <div class="example"> <pre class="example">(language-change <var>frame</var> <var>codepage</var> <var>language-id</var>) +</pre> +</div> <p>Here <var>frame</var> is the frame which was current when the input language changed; <var>codepage</var> is the new codepage number; and <var>language-id</var> is the numerical ID of the new input language. The coding-system (see <a href="coding-systems">Coding Systems</a>) that corresponds to <var>codepage</var> is <code>cp<var>codepage</var></code> or <code>windows-<var>codepage</var></code>. To convert <var>language-id</var> to a string (e.g., to use it for various language-dependent features, such as <code>set-language-environment</code>), use the <code>w32-get-locale-info</code> function, like this: </p> <div class="example"> <pre class="example">;; Get the abbreviated language name, such as "ENU" for English +(w32-get-locale-info language-id) +;; Get the full English name of the language, +;; such as "English (United States)" +(w32-get-locale-info language-id 4097) +;; Get the full localized name of the language +(w32-get-locale-info language-id t) +</pre> +</div> </dd> </dl> <p>If one of these events arrives in the middle of a key sequence—that is, after a prefix key—then Emacs reorders the events so that this event comes either before or after the multi-event key sequence, not within it. </p> <p>Some of these special events, such as <code>delete-frame</code>, invoke Emacs commands by default; others are not bound. If you want to arrange for a special event to invoke a command, you can do that via <code>special-event-map</code>. The command you bind to a function key in that map can then examine the full event which invoked it in <code>last-input-event</code>. See <a href="special-events">Special Events</a>. </p><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Misc-Events.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Misc-Events.html</a> + </p> +</div> |
