maps. The key sequence argument is represented as a string or vector.
The cursor does not move into the echo area. Prompt.
+If the key sequence is a down-event, the following up-event is discarded,
+but can be read via the @code{U} code character.
+
This kind of input is used by commands such as @code{describe-key} and
@code{global-set-key}.
Emacs Manual}). Prompt.
@item n
-A number read with the minibuffer. If the input is not a number, the
-user is asked to try again. The prefix argument, if any, is not used.
+A number, read with the minibuffer. If the input is not a number, the
+user has to try again. @samp{n} never uses the prefix argument.
Prompt.
@item N
-@cindex raw prefix argument usage
-The numeric prefix argument; but if there is no prefix argument, read a
-number as with @kbd{n}. Requires a number. @xref{Prefix Command
-Arguments}. Prompt.
+The numeric prefix argument; but if there is no prefix argument, read
+a number as with @kbd{n}. The value is always a number. @xref{Prefix
+Command Arguments}. Prompt.
@item p
@cindex numeric prefix argument usage
No I/O.
@item P
+@cindex raw prefix argument usage
The raw prefix argument. (Note that this @samp{P} is upper case.) No
I/O.
the string.) Other characters that normally terminate a symbol (e.g.,
parentheses and brackets) do not do so here. Prompt.
+@item U
+A key sequence or nil. May be used after a @code{k} or @code{K}
+argument to get the up-event that was discarded in case the key
+sequence read for that argument was a down-event. No I/O.
+
@item v
A variable declared to be a user option (i.e., satisfying the
predicate @code{user-variable-p}). This reads the variable using
@end deffn
@defun interactive-p
-This function returns @code{t} if the containing function (the one whose
-code includes the call to @code{interactive-p}) was called
-interactively, with the function @code{call-interactively}. (It makes
-no difference whether @code{call-interactively} was called from Lisp or
-directly from the editor command loop.) If the containing function was
-called by Lisp evaluation (or with @code{apply} or @code{funcall}), then
-it was not called interactively.
+This function returns @code{t} if the containing function (the one
+whose code includes the call to @code{interactive-p}) was called in
+direct response to user input. This means that it was called with the
+function @code{call-interactively}, and that a keyboard macro is
+not running, and that Emacs is not running in batch mode.
+
+If the containing function was called by Lisp evaluation (or with
+@code{apply} or @code{funcall}), then it was not called interactively.
@end defun
- The most common use of @code{interactive-p} is for deciding whether to
-print an informative message. As a special exception,
-@code{interactive-p} returns @code{nil} whenever a keyboard macro is
-being run. This is to suppress the informative messages and speed
-execution of the macro.
-
- For example:
+ The most common use of @code{interactive-p} is for deciding whether
+to give the user additional visual feedback (such as by printing an
+informative message). For example:
@example
@group
+;; @r{Here's the usual way to use @code{interactive-p}.}
(defun foo ()
(interactive)
(when (interactive-p)
@end group
@group
+;; @r{This function is just to illustrate the behavior.}
(defun bar ()
(interactive)
(setq foobar (list (foo) (interactive-p))))
@group
;; @r{Type @kbd{M-x bar}.}
-;; @r{This does not print anything.}
+;; @r{This does not display a message.}
@end group
@group
@end group
@end example
- The other way to do this sort of job is to make the command take an
-argument @code{print-message} which should be non-@code{nil} in an
-interactive call, and use the @code{interactive} spec to make sure it is
-non-@code{nil}. Here's how:
+ If you want to test @emph{only} whether the function was called
+using @code{call-interactively}, add an optional argument
+@code{print-message} which should be non-@code{nil} in an interactive
+call, and use the @code{interactive} spec to make sure it is
+non-@code{nil}. Here's an example:
@example
(defun foo (&optional print-message)
@end example
@noindent
-Defined in this way, the function does display the message when
-called from a keyboard macro.
+Defined in this way, the function does display the message when called
+from a keyboard macro. We use @code{"p"} because the numeric prefix
+argument is never @code{nil}.
+
+@defun called-interactively-p
+This function returns @code{t} when the calling function was called
+using @code{call-interactively}.
- The numeric prefix argument, provided by @samp{p}, is never @code{nil}.
+When possible, instead of using this function, you should use the
+method in the example above; that method makes it possible for a
+caller to ``pretend'' that the function was called interactively.
+@end defun
@node Command Loop Info
@comment node-name, next, previous, up
the window manager. Its standard definition is @code{ignore}; since the
frame has already been made visible, Emacs has no work to do.
-@cindex @code{mouse-wheel} event
-@item (mouse-wheel @var{position} @var{delta})
-This kind of event is generated by moving a wheel on a mouse (such as
-the MS Intellimouse). Its effect is typically a kind of scroll or zoom.
-
-The element @var{delta} describes the amount and direction of the wheel
-rotation. Its absolute value is the number of increments by which the
-wheel was rotated. A negative @var{delta} indicates that the wheel was
-rotated backwards, towards the user, and a positive @var{delta}
-indicates that the wheel was rotated forward, away from the user.
+@cindex @code{wheel-up} event
+@cindex @code{wheel-down} event
+@item (wheel-up @var{position})
+@item (wheel-down @var{position})
+These kinds of event are generated by moving a mouse wheel. Their
+usual meaning is a kind of scroll or zoom.
The element @var{position} is a list describing the position of the
event, in the same format as used in a mouse-click event.
-This kind of event is generated only on some kinds of systems.
+This kind of event is generated only on some kinds of systems. On some
+systems, @code{mouse-4} and @code{mouse-5} are used instead. For
+portable code, use the variables @code{mouse-wheel-up-event} and
+@code{mouse-wheel-down-event} defined in @file{mwheel.el} to determine
+what event types to expect for the mouse wheel.
@cindex @code{drag-n-drop} event
@item (drag-n-drop @var{position} @var{files})