aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorStefan Monnier2009-10-01 17:47:38 +0000
committerStefan Monnier2009-10-01 17:47:38 +0000
commit9d28c33edefe1b366f4c6944886a3e4cf294cf60 (patch)
tree49c37c932cee4f48d0bba8b7009ceec71af60d92 /src/eval.c
parentced10a4c9f0030e4e554d6ca3f96c6e366dba8db (diff)
downloademacs-9d28c33edefe1b366f4c6944886a3e4cf294cf60.tar.gz
emacs-9d28c33edefe1b366f4c6944886a3e4cf294cf60.zip
* 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.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index 8d446de09fc..20988392e5f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -608,19 +608,31 @@ use `called-interactively-p'. */)
608} 608}
609 609
610 610
611DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 0, 0, 611DEFUN ("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'.
613This includes being called as the binding of a key, or called from a 613If KIND is `interactive', then only return t if the call was made
614keyboard macro (unlike `interactive-p'). 614interactively by the user, i.e. not in `noninteractive' mode nor
615when `executing-kbd-macro'.
616If KIND is `any', on the other hand, it will return t for any kind of
617interactive call, including being called as the binding of a key, or
618from a keyboard macro, or in `noninteractive' mode.
619
620The only known proper use of `interactive' for KIND is in deciding
621whether to display a helpful message, or how to display it. If you're
622thinking of using it for any other purpose, it is quite likely that
623you're making a mistake. Think: what do you want to do when the
624command is called from a keyboard macro?
615 625
616This function is meant for implementing advice and other 626This function is meant for implementing advice and other
617function-modifying features. Instead of using this, it is sometimes 627function-modifying features. Instead of using this, it is sometimes
618cleaner to give your function an extra optional argument whose 628cleaner 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
620way to do this). */) 630way to do this), or via (not (or executing-kbd-macro noninteractive)). */)
621 () 631 (kind)
632 Lisp_Object kind;
622{ 633{
623 return interactive_p (1) ? Qt : Qnil; 634 return ((INTERACTIVE || !EQ (kind, intern ("interactive")))
635 && interactive_p (1)) ? Qt : Qnil;
624} 636}
625 637
626 638