diff options
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/commands.texi | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/subr.el | 50 |
4 files changed, 38 insertions, 27 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index da7709d354e..96615cf1d90 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-02-09 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * commands.texi (Accessing Mouse): Mention that these function | ||
| 4 | also work on keyboard events (bug#14228). | ||
| 5 | |||
| 1 | 2014-02-08 Lars Ingebrigtsen <larsi@gnus.org> | 6 | 2014-02-08 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 7 | ||
| 3 | * display.texi (Face Attributes): Add an index (bug#14924). | 8 | * display.texi (Face Attributes): Add an index (bug#14924). |
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index f9476e5e34c..fa95c7a74ac 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -1934,9 +1934,12 @@ must be the last element of the list. For example, | |||
| 1934 | @node Accessing Mouse | 1934 | @node Accessing Mouse |
| 1935 | @subsection Accessing Mouse Events | 1935 | @subsection Accessing Mouse Events |
| 1936 | @cindex mouse events, data in | 1936 | @cindex mouse events, data in |
| 1937 | @cindex keyboard events, data in | ||
| 1937 | 1938 | ||
| 1938 | This section describes convenient functions for accessing the data in | 1939 | This section describes convenient functions for accessing the data in |
| 1939 | a mouse button or motion event. | 1940 | a mouse button or motion event. Keyboard event data can be accessed |
| 1941 | using the same functions, but data elements that aren't applicable to | ||
| 1942 | keyboard events are zero or @code{nil}. | ||
| 1940 | 1943 | ||
| 1941 | The following two functions return a mouse position list | 1944 | The following two functions return a mouse position list |
| 1942 | (@pxref{Click Events}), specifying the position of a mouse event. | 1945 | (@pxref{Click Events}), specifying the position of a mouse event. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 493a3d13ad8..ead1915cef1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-02-09 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * subr.el (event-start): Doc fix (bug#14228). | ||
| 4 | (event-end): Ditto. | ||
| 5 | |||
| 1 | 2014-02-09 Glenn Morris <rgm@gnu.org> | 6 | 2014-02-09 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * emacs-lisp/warnings.el (lwarn): | 8 | * emacs-lisp/warnings.el (lwarn): |
diff --git a/lisp/subr.el b/lisp/subr.el index 7730a4327b4..669af38385c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1019,38 +1019,36 @@ in the current Emacs session, then this function may return nil." | |||
| 1019 | 1019 | ||
| 1020 | (defun event-start (event) | 1020 | (defun event-start (event) |
| 1021 | "Return the starting position of EVENT. | 1021 | "Return the starting position of EVENT. |
| 1022 | EVENT should be a click, drag, or key press event. | 1022 | EVENT should be a mouse click, drag, or key press event. |
| 1023 | If it is a key press event, the return value has the form | 1023 | |
| 1024 | (WINDOW POS (0 . 0) 0) | 1024 | The following accessor functions are used to access the elements |
| 1025 | If it is a click or drag event, it has the form | 1025 | of the position: |
| 1026 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) | 1026 | |
| 1027 | IMAGE (DX . DY) (WIDTH . HEIGHT)) | 1027 | `posn-window': The window the event is in. |
| 1028 | The `posn-' functions access elements of such lists. | 1028 | `posn-area': A symbol identifying the area the event occurred in, |
| 1029 | For more information, see Info node `(elisp)Click Events'. | 1029 | or nil if the event occurred in the text area. |
| 1030 | 1030 | `posn-point': The buffer position of the event. | |
| 1031 | If EVENT is a mouse or key press or a mouse click, this is the | 1031 | `posn-x-y': The pixel-based coordiates of the event. |
| 1032 | position of the event. If EVENT is a drag, this is the starting | 1032 | `posn-col-row': The estimated column and row corresponding to the |
| 1033 | position of the drag." | 1033 | position of the event. |
| 1034 | `posn-actual-col-row': The actual column and row corresponding to the | ||
| 1035 | position of the event. | ||
| 1036 | `posn-string': The string object of the event, which is either | ||
| 1037 | nil or (STRING . POSITION)'. | ||
| 1038 | `posn-image': The image object of the event, if any. | ||
| 1039 | `posn-object': The image or string object of the event, if any. | ||
| 1040 | `posn-timestamp': The time the event occurred, in milliseconds. | ||
| 1041 | |||
| 1042 | For more information, see Info node `(elisp)Click Events'." | ||
| 1034 | (if (consp event) (nth 1 event) | 1043 | (if (consp event) (nth 1 event) |
| 1035 | (or (posn-at-point) | 1044 | (or (posn-at-point) |
| 1036 | (list (selected-window) (point) '(0 . 0) 0)))) | 1045 | (list (selected-window) (point) '(0 . 0) 0)))) |
| 1037 | 1046 | ||
| 1038 | (defun event-end (event) | 1047 | (defun event-end (event) |
| 1039 | "Return the ending location of EVENT. | 1048 | "Return the ending position of EVENT. |
| 1040 | EVENT should be a click, drag, or key press event. | 1049 | EVENT should be a click, drag, or key press event. |
| 1041 | If EVENT is a key press event, the return value has the form | 1050 | |
| 1042 | (WINDOW POS (0 . 0) 0) | 1051 | See `event-start' for a description of the value returned." |
| 1043 | If EVENT is a click event, this function is the same as | ||
| 1044 | `event-start'. For click and drag events, the return value has | ||
| 1045 | the form | ||
| 1046 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) | ||
| 1047 | IMAGE (DX . DY) (WIDTH . HEIGHT)) | ||
| 1048 | The `posn-' functions access elements of such lists. | ||
| 1049 | For more information, see Info node `(elisp)Click Events'. | ||
| 1050 | |||
| 1051 | If EVENT is a mouse or key press or a mouse click, this is the | ||
| 1052 | position of the event. If EVENT is a drag, this is the starting | ||
| 1053 | position of the drag." | ||
| 1054 | (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) | 1052 | (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) |
| 1055 | (or (posn-at-point) | 1053 | (or (posn-at-point) |
| 1056 | (list (selected-window) (point) '(0 . 0) 0)))) | 1054 | (list (selected-window) (point) '(0 . 0) 0)))) |