Mercurial > emacs
comparison src/eval.c @ 105364:338d102432df
* eval.c (Fcalled_interactively_p): Add `kind' argument.
* subr.el (interactive-p): Mark obsolete.
(called-interactively-p): Make the optional-ness of `kind' obsolete.
* emacs-lisp/bytecomp.el (byte-compile-fdefinition): Make it obey
advertised-signature-table for subroutines as well.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 01 Oct 2009 17:47:38 +0000 |
parents | fb0a1e29af2a |
children | 68dd71358159 |
comparison
equal
deleted
inserted
replaced
105363:a3acd4b1e5cc | 105364:338d102432df |
---|---|
606 { | 606 { |
607 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil; | 607 return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil; |
608 } | 608 } |
609 | 609 |
610 | 610 |
611 DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 0, 0, | 611 DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 1, 0, |
612 doc: /* Return t if the containing function was called by `call-interactively'. | 612 doc: /* Return t if the containing function was called by `call-interactively'. |
613 This includes being called as the binding of a key, or called from a | 613 If KIND is `interactive', then only return t if the call was made |
614 keyboard macro (unlike `interactive-p'). | 614 interactively by the user, i.e. not in `noninteractive' mode nor |
615 when `executing-kbd-macro'. | |
616 If KIND is `any', on the other hand, it will return t for any kind of | |
617 interactive call, including being called as the binding of a key, or | |
618 from a keyboard macro, or in `noninteractive' mode. | |
619 | |
620 The only known proper use of `interactive' for KIND is in deciding | |
621 whether to display a helpful message, or how to display it. If you're | |
622 thinking of using it for any other purpose, it is quite likely that | |
623 you're making a mistake. Think: what do you want to do when the | |
624 command is called from a keyboard macro? | |
615 | 625 |
616 This function is meant for implementing advice and other | 626 This function is meant for implementing advice and other |
617 function-modifying features. Instead of using this, it is sometimes | 627 function-modifying features. Instead of using this, it is sometimes |
618 cleaner to give your function an extra optional argument whose | 628 cleaner to give your function an extra optional argument whose |
619 `interactive' spec specifies non-nil unconditionally (\"p\" is a good | 629 `interactive' spec specifies non-nil unconditionally (\"p\" is a good |
620 way to do this). */) | 630 way to do this), or via (not (or executing-kbd-macro noninteractive)). */) |
621 () | 631 (kind) |
622 { | 632 Lisp_Object kind; |
623 return interactive_p (1) ? Qt : Qnil; | 633 { |
634 return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) | |
635 && interactive_p (1)) ? Qt : Qnil; | |
624 } | 636 } |
625 | 637 |
626 | 638 |
627 /* Return 1 if function in which this appears was called using | 639 /* Return 1 if function in which this appears was called using |
628 call-interactively. | 640 call-interactively. |