comparison src/eval.c @ 90043:e24e2e78deda

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-69 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-643 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-649 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-650 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-651 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-655 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-656 Update from CVS: lisp/man.el (Man-xref-normal-file): Fix help-echo. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-657 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-658 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-659 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-660 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-661 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-667 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-61 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 04 Nov 2004 08:55:40 +0000
parents 0bdb5a16ae51 d502896ff443
children cb7f41387eb3
comparison
equal deleted inserted replaced
90042:003d95404d71 90043:e24e2e78deda
538 return Fcar (args); 538 return Fcar (args);
539 } 539 }
540 540
541 541
542 DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, 542 DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,
543 doc: /* Return t if function in which this appears was called interactively. 543 doc: /* Return t if the function was run directly by user input.
544 This means that the function was called with call-interactively (which 544 This means that the function was called with call-interactively (which
545 includes being called as the binding of a key) 545 includes being called as the binding of a key)
546 and input is currently coming from the keyboard (not in keyboard macro). */) 546 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.) */)
547 () 559 ()
548 { 560 {
549 return interactive_p (1) ? Qt : Qnil; 561 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil;
550 } 562 }
551 563
552 564
553 /* Return 1 if function in which this appears was called 565 DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 0, 0,
554 interactively. This means that the function was called with 566 doc: /* Return t if the function using this was called with call-interactively.
555 call-interactively (which includes being called as the binding of 567 This is used for implementing advice and other function-modifying
556 a key) and input is currently coming from the keyboard (not in 568 features of Emacs.
557 keyboard macro). 569
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.
558 582
559 EXCLUDE_SUBRS_P non-zero means always return 0 if the function 583 EXCLUDE_SUBRS_P non-zero means always return 0 if the function
560 called is a built-in. */ 584 called is a built-in. */
561 585
562 int 586 int
563 interactive_p (exclude_subrs_p) 587 interactive_p (exclude_subrs_p)
564 int exclude_subrs_p; 588 int exclude_subrs_p;
565 { 589 {
566 struct backtrace *btp; 590 struct backtrace *btp;
567 Lisp_Object fun; 591 Lisp_Object fun;
568
569 if (!INTERACTIVE)
570 return 0;
571 592
572 btp = backtrace_list; 593 btp = backtrace_list;
573 594
574 /* If this isn't a byte-compiled function, there may be a frame at 595 /* If this isn't a byte-compiled function, there may be a frame at
575 the top for Finteractive_p. If so, skip it. */ 596 the top for Finteractive_p. If so, skip it. */
1973 Lisp_Object fun, val, original_fun, original_args; 1994 Lisp_Object fun, val, original_fun, original_args;
1974 Lisp_Object funcar; 1995 Lisp_Object funcar;
1975 struct backtrace backtrace; 1996 struct backtrace backtrace;
1976 struct gcpro gcpro1, gcpro2, gcpro3; 1997 struct gcpro gcpro1, gcpro2, gcpro3;
1977 1998
1978 if (handling_signal) 1999 if (handling_signal || INPUT_BLOCKED_P)
1979 abort (); 2000 abort ();
1980 2001
1981 if (SYMBOLP (form)) 2002 if (SYMBOLP (form))
1982 return Fsymbol_value (form); 2003 return Fsymbol_value (form);
1983 if (!CONSP (form)) 2004 if (!CONSP (form))
3447 defsubr (&Sthrow); 3468 defsubr (&Sthrow);
3448 defsubr (&Sunwind_protect); 3469 defsubr (&Sunwind_protect);
3449 defsubr (&Scondition_case); 3470 defsubr (&Scondition_case);
3450 defsubr (&Ssignal); 3471 defsubr (&Ssignal);
3451 defsubr (&Sinteractive_p); 3472 defsubr (&Sinteractive_p);
3473 defsubr (&Scalled_interactively_p);
3452 defsubr (&Scommandp); 3474 defsubr (&Scommandp);
3453 defsubr (&Sautoload); 3475 defsubr (&Sautoload);
3454 defsubr (&Seval); 3476 defsubr (&Seval);
3455 defsubr (&Sapply); 3477 defsubr (&Sapply);
3456 defsubr (&Sfuncall); 3478 defsubr (&Sfuncall);