aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/subr.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 74809c678eb..d93ffa7150b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -678,7 +678,7 @@ The value is a printing character (not upper case) or a symbol."
678 678
679(defsubst event-start (event) 679(defsubst event-start (event)
680 "Return the starting position of EVENT. 680 "Return the starting position of EVENT.
681If EVENT is a mouse press or a mouse click, this returns the location 681If EVENT is a mouse or key press or a mouse click, this returns the location
682of the event. 682of the event.
683If EVENT is a drag, this returns the drag's starting position. 683If EVENT is a drag, this returns the drag's starting position.
684The return value is of the form 684The return value is of the form
@@ -689,7 +689,8 @@ The `posn-' functions access elements of such lists."
689 (list (selected-window) (point) '(0 . 0) 0))) 689 (list (selected-window) (point) '(0 . 0) 0)))
690 690
691(defsubst event-end (event) 691(defsubst event-end (event)
692 "Return the ending location of EVENT. EVENT should be a click or drag event. 692 "Return the ending location of EVENT.
693EVENT should be a click, drag, or key press event.
693If EVENT is a click event, this function is the same as `event-start'. 694If EVENT is a click event, this function is the same as `event-start'.
694The return value is of the form 695The return value is of the form
695 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) 696 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
@@ -727,6 +728,15 @@ and `event-end' functions."
727 (car (nth 1 position)) 728 (car (nth 1 position))
728 (nth 1 position)))) 729 (nth 1 position))))
729 730
731(defun posn-set-point (position)
732 "Move point to POSITION.
733Select the corresponding window as well."
734 (if (not (windowp (posn-window posn)))
735 (error "Position not in text area of window"))
736 (select-window (posn-window posn))
737 (if (numberp (posn-point posn))
738 (goto-char (posn-point posn))))
739
730(defsubst posn-x-y (position) 740(defsubst posn-x-y (position)
731 "Return the x and y coordinates in POSITION. 741 "Return the x and y coordinates in POSITION.
732POSITION should be a list of the form returned by the `event-start' 742POSITION should be a list of the form returned by the `event-start'