aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen2014-02-08 18:13:23 -0800
committerLars Ingebrigtsen2014-02-08 18:13:23 -0800
commitd6d5fdf826ce74ac3a99cb72aae54cbc2974ffe2 (patch)
treef28a50cd4c5626879d5d8c3c65540ab502d3bee9 /lisp
parent6995e5d0e54a41851bc6ce04d1c50749f531b077 (diff)
downloademacs-d6d5fdf826ce74ac3a99cb72aae54cbc2974ffe2.tar.gz
emacs-d6d5fdf826ce74ac3a99cb72aae54cbc2974ffe2.zip
Document the `event-start' and `event-end' functions more completely
* doc/lispref/commands.texi (Accessing Mouse): Mention that these function also work on keyboard events. * lisp/subr.el (event-start): Doc fix (bug#14228). (event-end): Ditto.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/subr.el50
2 files changed, 29 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 493a3d13ad8..ead1915cef1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12014-02-09 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * subr.el (event-start): Doc fix (bug#14228).
4 (event-end): Ditto.
5
12014-02-09 Glenn Morris <rgm@gnu.org> 62014-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.
1022EVENT should be a click, drag, or key press event. 1022EVENT should be a mouse click, drag, or key press event.
1023If it is a key press event, the return value has the form 1023
1024 (WINDOW POS (0 . 0) 0) 1024The following accessor functions are used to access the elements
1025If it is a click or drag event, it has the form 1025of 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.
1028The `posn-' functions access elements of such lists. 1028`posn-area': A symbol identifying the area the event occurred in,
1029For more information, see Info node `(elisp)Click Events'. 1029or nil if the event occurred in the text area.
1030 1030`posn-point': The buffer position of the event.
1031If 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.
1032position of the event. If EVENT is a drag, this is the starting 1032`posn-col-row': The estimated column and row corresponding to the
1033position of the drag." 1033position of the event.
1034`posn-actual-col-row': The actual column and row corresponding to the
1035position of the event.
1036`posn-string': The string object of the event, which is either
1037nil 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
1042For 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.
1040EVENT should be a click, drag, or key press event. 1049EVENT should be a click, drag, or key press event.
1041If EVENT is a key press event, the return value has the form 1050
1042 (WINDOW POS (0 . 0) 0) 1051See `event-start' for a description of the value returned."
1043If EVENT is a click event, this function is the same as
1044`event-start'. For click and drag events, the return value has
1045the form
1046 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
1047 IMAGE (DX . DY) (WIDTH . HEIGHT))
1048The `posn-' functions access elements of such lists.
1049For more information, see Info node `(elisp)Click Events'.
1050
1051If EVENT is a mouse or key press or a mouse click, this is the
1052position of the event. If EVENT is a drag, this is the starting
1053position 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))))