/[emacs]/emacs/lispref/commands.texi
ViewVC logotype

Diff of /emacs/lispref/commands.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.36.2.10 by miles, Mon Oct 25 04:22:22 2004 UTC revision 1.36.2.11 by miles, Fri Oct 29 02:05:13 2004 UTC
# Line 360  until a command (or undefined command) i Line 360  until a command (or undefined command) i
360  maps.  The key sequence argument is represented as a string or vector.  maps.  The key sequence argument is represented as a string or vector.
361  The cursor does not move into the echo area.  Prompt.  The cursor does not move into the echo area.  Prompt.
362    
363    If the key sequence is a down-event, the following up-event is discarded,
364    but can be read via the @code{U} code character.
365    
366  This kind of input is used by commands such as @code{describe-key} and  This kind of input is used by commands such as @code{describe-key} and
367  @code{global-set-key}.  @code{global-set-key}.
368    
# Line 379  method, and returned as a string (@pxref Line 382  method, and returned as a string (@pxref
382  Emacs Manual}).  Prompt.  Emacs Manual}).  Prompt.
383    
384  @item n  @item n
385  A number read with the minibuffer.  If the input is not a number, the  A number, read with the minibuffer.  If the input is not a number, the
386  user is asked to try again.  The prefix argument, if any, is not used.  user has to try again.  @samp{n} never uses the prefix argument.
387  Prompt.  Prompt.
388    
389  @item N  @item N
390  @cindex raw prefix argument usage  The numeric prefix argument; but if there is no prefix argument, read
391  The numeric prefix argument; but if there is no prefix argument, read a  a number as with @kbd{n}.  The value is always a number.  @xref{Prefix
392  number as with @kbd{n}.  Requires a number.  @xref{Prefix Command  Command Arguments}.  Prompt.
 Arguments}.  Prompt.  
393    
394  @item p  @item p
395  @cindex numeric prefix argument usage  @cindex numeric prefix argument usage
# Line 395  The numeric prefix argument.  (Note that Line 397  The numeric prefix argument.  (Note that
397  No I/O.  No I/O.
398    
399  @item P  @item P
400    @cindex raw prefix argument usage
401  The raw prefix argument.  (Note that this @samp{P} is upper case.)  No  The raw prefix argument.  (Note that this @samp{P} is upper case.)  No
402  I/O.  I/O.
403    
# Line 416  character terminates the input.  (Use @k Line 419  character terminates the input.  (Use @k
419  the string.)  Other characters that normally terminate a symbol (e.g.,  the string.)  Other characters that normally terminate a symbol (e.g.,
420  parentheses and brackets) do not do so here.  Prompt.  parentheses and brackets) do not do so here.  Prompt.
421    
422    @item U
423    A key sequence or nil.  May be used after a @code{k} or @code{K}
424    argument to get the up-event that was discarded in case the key
425    sequence read for that argument was a down-event.  No I/O.
426    
427  @item v  @item v
428  A variable declared to be a user option (i.e., satisfying the  A variable declared to be a user option (i.e., satisfying the
429  predicate @code{user-variable-p}).  This reads the variable using  predicate @code{user-variable-p}).  This reads the variable using
# Line 605  part of the prompt. Line 613  part of the prompt.
613  @end deffn  @end deffn
614    
615  @defun interactive-p  @defun interactive-p
616  This function returns @code{t} if the containing function (the one whose  This function returns @code{t} if the containing function (the one
617  code includes the call to @code{interactive-p}) was called  whose code includes the call to @code{interactive-p}) was called in
618  interactively, with the function @code{call-interactively}.  (It makes  direct response to user input.  This means that it was called with the
619  no difference whether @code{call-interactively} was called from Lisp or  function @code{call-interactively}, and that a keyboard macro is
620  directly from the editor command loop.)  If the containing function was  not running.
 called by Lisp evaluation (or with @code{apply} or @code{funcall}), then  
 it was not called interactively.  
 @end defun  
621    
622    The most common use of @code{interactive-p} is for deciding whether to  If the containing function was called by Lisp evaluation (or with
623  print an informative message.  As a special exception,  @code{apply} or @code{funcall}), then it was not called interactively.
624  @code{interactive-p} returns @code{nil} whenever a keyboard macro is  @end defun
 being run.  This is to suppress the informative messages and speed  
 execution of the macro.  
625    
626    For example:    The most common use of @code{interactive-p} is for deciding whether
627    to give the user additional visual feedback (such as by printing an
628    informative message).  For example:
629    
630  @example  @example
631  @group  @group
632    ;; @r{Here's the usual way to use @code{interactive-p}.}
633  (defun foo ()  (defun foo ()
634    (interactive)    (interactive)
635    (when (interactive-p)    (when (interactive-p)
# Line 632  execution of the macro. Line 638  execution of the macro.
638  @end group  @end group
639    
640  @group  @group
641    ;; @r{This function is just to illustrate the behavior.}
642  (defun bar ()  (defun bar ()
643    (interactive)    (interactive)
644    (setq foobar (list (foo) (interactive-p))))    (setq foobar (list (foo) (interactive-p))))
# Line 645  execution of the macro. Line 652  execution of the macro.
652    
653  @group  @group
654  ;; @r{Type @kbd{M-x bar}.}  ;; @r{Type @kbd{M-x bar}.}
655  ;; @r{This does not print anything.}  ;; @r{This does not display a message.}
656  @end group  @end group
657    
658  @group  @group
# Line 654  foobar Line 661  foobar
661  @end group  @end group
662  @end example  @end example
663    
664    The other way to do this sort of job is to make the command take an    If you want to test @emph{only} whether the function was called
665  argument @code{print-message} which should be non-@code{nil} in an  using @code{call-interactively}, add an optional argument
666  interactive call, and use the @code{interactive} spec to make sure it is  @code{print-message} which should be non-@code{nil} in an interactive
667  non-@code{nil}.  Here's how:  call, and use the @code{interactive} spec to make sure it is
668    non-@code{nil}.  Here's an example:
669    
670  @example  @example
671  (defun foo (&optional print-message)  (defun foo (&optional print-message)
# Line 667  non-@code{nil}.  Here's how: Line 675  non-@code{nil}.  Here's how:
675  @end example  @end example
676    
677  @noindent  @noindent
678  Defined in this way, the function does display the message when  Defined in this way, the function does display the message when called
679  called from a keyboard macro.  from a keyboard macro.  We use @code{"p"} because the numeric prefix
680    argument is never @code{nil}.
   The numeric prefix argument, provided by @samp{p}, is never @code{nil}.  
681    
682  @node Command Loop Info  @node Command Loop Info
683  @comment  node-name,  next,  previous,  up  @comment  node-name,  next,  previous,  up
# Line 1505  frame has already been made visible, Ema Line 1512  frame has already been made visible, Ema
1512  @cindex @code{wheel-down} event  @cindex @code{wheel-down} event
1513  @item (wheel-up @var{position})  @item (wheel-up @var{position})
1514  @item (wheel-down @var{position})  @item (wheel-down @var{position})
1515  This kind of event is generated by moving a wheel on a mouse.  Its  These kinds of event are generated by moving a mouse wheel.  Their
1516  effect is typically a kind of scroll or zoom.  usual meaning is a kind of scroll or zoom.
1517    
1518  The element @var{position} is a list describing the position of the  The element @var{position} is a list describing the position of the
1519  event, in the same format as used in a mouse-click event.  event, in the same format as used in a mouse-click event.
1520    
1521  This kind of event is generated only on some kinds of systems. On  This kind of event is generated only on some kinds of systems. On some
1522  other systems, mouse-4 and mouse-5 may be used instead.  For portable  systems, @code{mouse-4} and @code{mouse-5} are used instead.  For
1523  code, the variables @code{mouse-wheel-up-event} and  portable code, use the variables @code{mouse-wheel-up-event} and
1524  @code{mouse-wheel-down-event} defined in @file{mwheel.el} can be used.  @code{mouse-wheel-down-event} defined in @file{mwheel.el} to determine
1525    what event types to expect for the mouse wheel.
1526    
1527  @cindex @code{drag-n-drop} event  @cindex @code{drag-n-drop} event
1528  @item (drag-n-drop @var{position} @var{files})  @item (drag-n-drop @var{position} @var{files})

Legend:
Removed from v.1.36.2.10  
changed lines
  Added in v.1.36.2.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26