# HG changeset patch # User Luc Teirlinck # Date 1074215266 0 # Node ID 39793eabee873defef62f5e65081757c7db39f1d # Parent 26d79d57957080e5550f7a44dd5bc12845a88674 (declare): New macro. diff -r 26d79d579570 -r 39793eabee87 lisp/subr.el --- a/lisp/subr.el Fri Jan 16 00:51:12 2004 +0000 +++ b/lisp/subr.el Fri Jan 16 01:07:46 2004 +0000 @@ -65,7 +65,7 @@ (defmacro noreturn (form) "Evaluates FORM, with the expectation that the evaluation will signal an error instead of returning to its caller. If FORM does return, an error is -signalled." +signalled." `(prog1 ,form (error "Form marked with `noreturn' did return"))) @@ -158,6 +158,12 @@ (setq ,(car spec) (1+ ,(car spec)))) ,@(cdr (cdr spec))))) +(defmacro declare (&rest specs) + "Do not evaluate any arguments and return nil. +Treated as a declaration when used at the right place in a +`defmacro' form. \(See Info anchor `(elisp)Definition of declare'." + nil) + (defsubst caar (x) "Return the car of the car of X." (car (car x))) @@ -689,13 +695,13 @@ (defsubst posn-window (position) "Return the window in POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 0 position)) (defsubst posn-area (position) "Return the window area recorded in POSITION, or nil for the text area. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (let ((area (if (consp (nth 1 position)) (car (nth 1 position)) (nth 1 position)))) @@ -704,7 +710,7 @@ (defsubst posn-point (position) "Return the buffer location in POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (or (nth 5 position) (if (consp (nth 1 position)) (car (nth 1 position)) @@ -713,18 +719,18 @@ (defsubst posn-x-y (position) "Return the x and y coordinates in POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 2 position)) (defun posn-col-row (position) "Return the nominal column and row in POSITION, measured in characters. The column and row values are approximations calculated from the x and y coordinates in POSITION and the frame's default character width -and height. +and height. For a scroll-bar event, the result column is 0, and the row corresponds to the vertical position of the click in the scroll bar. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (let* ((pair (posn-x-y position)) (window (posn-window position)) (area (posn-area position))) @@ -750,43 +756,43 @@ Return nil if POSITION does not contain the actual position; in that case `posn-col-row' can be used to get approximate values. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 6 position)) (defsubst posn-timestamp (position) "Return the timestamp of POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 3 position)) (defsubst posn-string (position) "Return the string object of POSITION, or nil if a buffer position. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 4 position)) (defsubst posn-image (position) "Return the image object of POSITION, or nil if a not an image. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 7 position)) (defsubst posn-object (position) "Return the object (image or string) of POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (or (posn-image position) (posn-string position))) (defsubst posn-object-x-y (position) "Return the x and y coordinates relative to the object of POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 8 position)) (defsubst posn-object-width-height (position) "Return the pixel width and height of the object of POSITION. POSITION should be a list of the form returned by the `event-start' -and `event-end' functions." +and `event-end' functions." (nth 9 position))