diff options
| author | Stefan Monnier | 2009-10-01 17:47:38 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-10-01 17:47:38 +0000 |
| commit | 9d28c33edefe1b366f4c6944886a3e4cf294cf60 (patch) | |
| tree | 49c37c932cee4f48d0bba8b7009ceec71af60d92 /src/eval.c | |
| parent | ced10a4c9f0030e4e554d6ca3f96c6e366dba8db (diff) | |
| download | emacs-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.c | 24 |
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 | ||
| 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) |
| 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 | ||