aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKim F. Storm2004-01-06 23:04:44 +0000
committerKim F. Storm2004-01-06 23:04:44 +0000
commit4385264a7d76a470557075c8bc283079c9e28ab6 (patch)
treea6fa4f6f953a11c0e1be180c82f393fd296d093e /lisp
parent349c653ee57a17fed33bf359e2ef965f58d03a4c (diff)
downloademacs-4385264a7d76a470557075c8bc283079c9e28ab6.tar.gz
emacs-4385264a7d76a470557075c8bc283079c9e28ab6.zip
(event-start, event-end): Doc fix.
(posn-string, posn-image): New defuns. (posn-object): Return either image or string object. (posn-object-x-y): Return 8th element of position. (posn-object-width-height): New defun.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el30
1 files changed, 25 insertions, 5 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index b251ab6573a..cd3eefe2520 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -665,7 +665,8 @@ If EVENT is a mouse press or a mouse click, this returns the location
665of the event. 665of the event.
666If EVENT is a drag, this returns the drag's starting position. 666If EVENT is a drag, this returns the drag's starting position.
667The return value is of the form 667The return value is of the form
668 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)) 668 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
669 IMAGE (DX . DY) (WIDTH . HEIGHT))
669The `posn-' functions access elements of such lists." 670The `posn-' functions access elements of such lists."
670 (if (consp event) (nth 1 event) 671 (if (consp event) (nth 1 event)
671 (list (selected-window) (point) '(0 . 0) 0))) 672 (list (selected-window) (point) '(0 . 0) 0)))
@@ -674,7 +675,8 @@ The `posn-' functions access elements of such lists."
674 "Return the ending location of EVENT. EVENT should be a click or drag event. 675 "Return the ending location of EVENT. EVENT should be a click or drag event.
675If EVENT is a click event, this function is the same as `event-start'. 676If EVENT is a click event, this function is the same as `event-start'.
676The return value is of the form 677The return value is of the form
677 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)) 678 (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
679 IMAGE (DX . DY) (WIDTH . HEIGHT))
678The `posn-' functions access elements of such lists." 680The `posn-' functions access elements of such lists."
679 (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event) 681 (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event)
680 (list (selected-window) (point) '(0 . 0) 0))) 682 (list (selected-window) (point) '(0 . 0) 0)))
@@ -757,17 +759,35 @@ POSITION should be a list of the form returned by the `event-start'
757and `event-end' functions." 759and `event-end' functions."
758 (nth 3 position)) 760 (nth 3 position))
759 761
760(defsubst posn-object (position) 762(defsubst posn-string (position)
761 "Return the object of POSITION. 763 "Return the string object of POSITION, or nil if a buffer position.
762POSITION should be a list of the form returned by the `event-start' 764POSITION should be a list of the form returned by the `event-start'
763and `event-end' functions." 765and `event-end' functions."
764 (nth 4 position)) 766 (nth 4 position))
765 767
768(defsubst posn-image (position)
769 "Return the image object of POSITION, or nil if a not an image.
770POSITION should be a list of the form returned by the `event-start'
771and `event-end' functions."
772 (nth 7 position))
773
774(defsubst posn-object (position)
775 "Return the object (image or string) of POSITION.
776POSITION should be a list of the form returned by the `event-start'
777and `event-end' functions."
778 (or (posn-image position) (posn-string position)))
779
766(defsubst posn-object-x-y (position) 780(defsubst posn-object-x-y (position)
767 "Return the x and y coordinates relative to the object of POSITION. 781 "Return the x and y coordinates relative to the object of POSITION.
768POSITION should be a list of the form returned by the `event-start' 782POSITION should be a list of the form returned by the `event-start'
769and `event-end' functions." 783and `event-end' functions."
770 (nth 7 position)) 784 (nth 8 position))
785
786(defsubst posn-object-width-height (position)
787 "Return the pixel width and height of the object of POSITION.
788POSITION should be a list of the form returned by the `event-start'
789and `event-end' functions."
790 (nth 9 position))
771 791
772 792
773;;;; Obsolescent names for functions. 793;;;; Obsolescent names for functions.