aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/eval.c24
2 files changed, 23 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3e36b223142..afdfff07562 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,10 @@
12009-10-01 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * eval.c (Fcalled_interactively_p): Add `kind' argument.
4
12009-10-01 Michael Albinus <michael.albinus@gmx.de> 52009-10-01 Michael Albinus <michael.albinus@gmx.de>
2 6
3 * fileio.c (Fdelete_directory_internal): Renamed from 7 * fileio.c (Fdelete_directory_internal): Rename from
4 Fdelete_directory. It is not a command anymore. It has no file 8 Fdelete_directory. It is not a command anymore. It has no file
5 name handler. 9 name handler.
6 10
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