diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/eval.c | 24 |
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 @@ | |||
| 1 | 2009-10-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * eval.c (Fcalled_interactively_p): Add `kind' argument. | ||
| 4 | |||
| 1 | 2009-10-01 Michael Albinus <michael.albinus@gmx.de> | 5 | 2009-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 | ||
| 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 | ||