/[emacs]/emacs/src/eval.c
ViewVC logotype

Diff of /emacs/src/eval.c

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

revision 1.221 by teirllm, Thu Jul 29 01:41:36 2004 UTC revision 1.222 by rms, Tue Nov 2 08:59:26 2004 UTC
# Line 540  usage: (function ARG)  */) Line 540  usage: (function ARG)  */)
540    
541    
542  DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,  DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,
543         doc: /* Return t if function in which this appears was called interactively.         doc: /* Return t if the function was run directly by user input.
544  This means that the function was called with call-interactively (which  This means that the function was called with call-interactively (which
545  includes being called as the binding of a key)  includes being called as the binding of a key)
546  and input is currently coming from the keyboard (not in keyboard macro).  */)  and input is currently coming from the keyboard (not in keyboard macro),
547    and Emacs is not running in batch mode (`noninteractive' is nil).
548    
549    The only known proper use of `interactive-p' is in deciding whether to
550    display a helpful message, or how to display it.  If you're thinking
551    of using it for any other purpose, it is quite likely that you're
552    making a mistake.  Think: what do you want to do when the command is
553    called from a keyboard macro?
554    
555    If you want to test whether your function was called with
556    `call-interactively', the way to do that is by adding an extra
557    optional argument, and making the `interactive' spec specify non-nil
558    unconditionally for that argument.  (`p' is a good way to do this.)  */)
559       ()       ()
560  {  {
561    return interactive_p (1) ? Qt : Qnil;    return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
562  }  }
563    
564    
565  /*  Return 1 if function in which this appears was called  DEFUN ("called-interactively-p", Fcall_interactive_p, Scall_interactive_p, 0, 0, 0,
566      interactively.  This means that the function was called with         doc: /* Return t if the function using this was called with call-interactively.
567      call-interactively (which includes being called as the binding of  This is used for implementing advice and other function-modifying
568      a key) and input is currently coming from the keyboard (not in  features of Emacs.
569      keyboard macro).  
570    The cleanest way to test whether your function was called with
571    `call-interactively', the way to do that is by adding an extra
572    optional argument, and making the `interactive' spec specify non-nil
573    unconditionally for that argument.  (`p' is a good way to do this.)  */)
574         ()
575    {
576      return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
577    }
578    
579    
580    /*  Return 1 if function in which this appears was called using
581        call-interactively.
582    
583      EXCLUDE_SUBRS_P non-zero means always return 0 if the function      EXCLUDE_SUBRS_P non-zero means always return 0 if the function
584      called is a built-in.  */      called is a built-in.  */
# Line 566  interactive_p (exclude_subrs_p) Line 590  interactive_p (exclude_subrs_p)
590    struct backtrace *btp;    struct backtrace *btp;
591    Lisp_Object fun;    Lisp_Object fun;
592    
   if (!INTERACTIVE)  
     return 0;  
   
593    btp = backtrace_list;    btp = backtrace_list;
594    
595    /* If this isn't a byte-compiled function, there may be a frame at    /* If this isn't a byte-compiled function, there may be a frame at
# Line 1975  DEFUN ("eval", Feval, Seval, 1, 1, 0, Line 1996  DEFUN ("eval", Feval, Seval, 1, 1, 0,
1996    struct backtrace backtrace;    struct backtrace backtrace;
1997    struct gcpro gcpro1, gcpro2, gcpro3;    struct gcpro gcpro1, gcpro2, gcpro3;
1998    
1999    if (handling_signal)    if (handling_signal || INPUT_BLOCKED_P)
2000      abort ();      abort ();
2001    
2002    if (SYMBOLP (form))    if (SYMBOLP (form))

Legend:
Removed from v.1.221  
changed lines
  Added in v.1.222

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