aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2004-10-27 14:59:47 +0000
committerRichard M. Stallman2004-10-27 14:59:47 +0000
commitdff3f9e1b8fbf5d1c01304d3d8b778723f669714 (patch)
tree8955a2c79f2cb8d295a4620fe9db74b9f7ba5fba
parentf91f2dcc78bde3379c6f8152369a7d6858353b5e (diff)
downloademacs-dff3f9e1b8fbf5d1c01304d3d8b778723f669714.tar.gz
emacs-dff3f9e1b8fbf5d1c01304d3d8b778723f669714.zip
(Interactive Codes): `N' uses numeric prefix, not raw. Clarify `n'.
(Interactive Call): Rewrite interactive-p, focusing on when and how to use it. (Misc Events): Clarify previous change.
-rw-r--r--lispref/commands.texi70
1 files changed, 35 insertions, 35 deletions
diff --git a/lispref/commands.texi b/lispref/commands.texi
index cb772ff6eb5..f1f94e11838 100644
--- a/lispref/commands.texi
+++ b/lispref/commands.texi
@@ -382,15 +382,14 @@ method, and returned as a string (@pxref{Input Methods,,, emacs, The GNU
382Emacs Manual}). Prompt. 382Emacs Manual}). Prompt.
383 383
384@item n 384@item n
385A number read with the minibuffer. If the input is not a number, the 385A number, read with the minibuffer. If the input is not a number, the
386user is asked to try again. The prefix argument, if any, is not used. 386user has to try again. @samp{n} never uses the prefix argument.
387Prompt. 387Prompt.
388 388
389@item N 389@item N
390@cindex raw prefix argument usage 390The numeric prefix argument; but if there is no prefix argument, read
391The numeric prefix argument; but if there is no prefix argument, read a 391a number as with @kbd{n}. The value is always a number. @xref{Prefix
392number as with @kbd{n}. Requires a number. @xref{Prefix Command 392Command Arguments}. Prompt.
393Arguments}. Prompt.
394 393
395@item p 394@item p
396@cindex numeric prefix argument usage 395@cindex numeric prefix argument usage
@@ -398,6 +397,7 @@ The numeric prefix argument. (Note that this @samp{p} is lower case.)
398No I/O. 397No I/O.
399 398
400@item P 399@item P
400@cindex raw prefix argument usage
401The raw prefix argument. (Note that this @samp{P} is upper case.) No 401The raw prefix argument. (Note that this @samp{P} is upper case.) No
402I/O. 402I/O.
403 403
@@ -613,25 +613,23 @@ part of the prompt.
613@end deffn 613@end deffn
614 614
615@defun interactive-p 615@defun interactive-p
616This function returns @code{t} if the containing function (the one whose 616This function returns @code{t} if the containing function (the one
617code includes the call to @code{interactive-p}) was called 617whose code includes the call to @code{interactive-p}) was called in
618interactively, with the function @code{call-interactively}. (It makes 618direct response to user input. This means that it was called with the
619no difference whether @code{call-interactively} was called from Lisp or 619function @code{call-interactively}, and that a keyboard macro is
620directly from the editor command loop.) If the containing function was 620not running.
621called by Lisp evaluation (or with @code{apply} or @code{funcall}), then 621
622it was not called interactively. 622If the containing function was called by Lisp evaluation (or with
623@code{apply} or @code{funcall}), then it was not called interactively.
623@end defun 624@end defun
624 625
625 The most common use of @code{interactive-p} is for deciding whether to 626 The most common use of @code{interactive-p} is for deciding whether
626print an informative message. As a special exception, 627to give the user additional visual feedback (such as by printing an
627@code{interactive-p} returns @code{nil} whenever a keyboard macro is 628informative message). For example:
628being run. This is to suppress the informative messages and speed
629execution of the macro.
630
631 For example:
632 629
633@example 630@example
634@group 631@group
632;; @r{Here's the usual way to use @code{interactive-p}.}
635(defun foo () 633(defun foo ()
636 (interactive) 634 (interactive)
637 (when (interactive-p) 635 (when (interactive-p)
@@ -640,6 +638,7 @@ execution of the macro.
640@end group 638@end group
641 639
642@group 640@group
641;; @r{This function is just to illustrate the behavior.}
643(defun bar () 642(defun bar ()
644 (interactive) 643 (interactive)
645 (setq foobar (list (foo) (interactive-p)))) 644 (setq foobar (list (foo) (interactive-p))))
@@ -653,7 +652,7 @@ execution of the macro.
653 652
654@group 653@group
655;; @r{Type @kbd{M-x bar}.} 654;; @r{Type @kbd{M-x bar}.}
656;; @r{This does not print anything.} 655;; @r{This does not display a message.}
657@end group 656@end group
658 657
659@group 658@group
@@ -662,10 +661,11 @@ foobar
662@end group 661@end group
663@end example 662@end example
664 663
665 The other way to do this sort of job is to make the command take an 664 If you want to test @emph{only} whether the function was called
666argument @code{print-message} which should be non-@code{nil} in an 665using @code{call-interactively}, add an optional argument
667interactive call, and use the @code{interactive} spec to make sure it is 666@code{print-message} which should be non-@code{nil} in an interactive
668non-@code{nil}. Here's how: 667call, and use the @code{interactive} spec to make sure it is
668non-@code{nil}. Here's an example:
669 669
670@example 670@example
671(defun foo (&optional print-message) 671(defun foo (&optional print-message)
@@ -675,10 +675,9 @@ non-@code{nil}. Here's how:
675@end example 675@end example
676 676
677@noindent 677@noindent
678Defined in this way, the function does display the message when 678Defined in this way, the function does display the message when called
679called from a keyboard macro. 679from a keyboard macro. We use @code{"p"} because the numeric prefix
680 680argument is never @code{nil}.
681 The numeric prefix argument, provided by @samp{p}, is never @code{nil}.
682 681
683@node Command Loop Info 682@node Command Loop Info
684@comment node-name, next, previous, up 683@comment node-name, next, previous, up
@@ -1513,16 +1512,17 @@ frame has already been made visible, Emacs has no work to do.
1513@cindex @code{wheel-down} event 1512@cindex @code{wheel-down} event
1514@item (wheel-up @var{position}) 1513@item (wheel-up @var{position})
1515@item (wheel-down @var{position}) 1514@item (wheel-down @var{position})
1516This kind of event is generated by moving a wheel on a mouse. Its 1515These kinds of event are generated by moving a mouse wheel. Their
1517effect is typically a kind of scroll or zoom. 1516usual meaning is a kind of scroll or zoom.
1518 1517
1519The element @var{position} is a list describing the position of the 1518The element @var{position} is a list describing the position of the
1520event, in the same format as used in a mouse-click event. 1519event, in the same format as used in a mouse-click event.
1521 1520
1522This kind of event is generated only on some kinds of systems. On 1521This kind of event is generated only on some kinds of systems. On some
1523other systems, mouse-4 and mouse-5 may be used instead. For portable 1522systems, @code{mouse-4} and @code{mouse-5} are used instead. For
1524code, the variables @code{mouse-wheel-up-event} and 1523portable code, use the variables @code{mouse-wheel-up-event} and
1525@code{mouse-wheel-down-event} defined in @file{mwheel.el} can be used. 1524@code{mouse-wheel-down-event} defined in @file{mwheel.el} to determine
1525what event types to expect for the mouse wheel.
1526 1526
1527@cindex @code{drag-n-drop} event 1527@cindex @code{drag-n-drop} event
1528@item (drag-n-drop @var{position} @var{files}) 1528@item (drag-n-drop @var{position} @var{files})