diff options
| author | Chong Yidong | 2009-08-15 21:51:33 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-08-15 21:51:33 +0000 |
| commit | 84b17ab096ecd55c381fb7b00ab5b324fedb477b (patch) | |
| tree | a1eb5bf7f35e751a9f1e7eb791348c03dc89714c | |
| parent | 89a9e058e25a25e8838aee4c27c4fa88550cc0f9 (diff) | |
| download | emacs-84b17ab096ecd55c381fb7b00ab5b324fedb477b.tar.gz emacs-84b17ab096ecd55c381fb7b00ab5b324fedb477b.zip | |
* eval.c (Fcalled_interactively_p, Finteractive_p): Doc
fix (Bug#3936).
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/eval.c | 29 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 11c371b6cca..12154bc0bb7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -9,6 +9,9 @@ | |||
| 9 | 9 | ||
| 10 | 2009-08-15 Chong Yidong <cyd@stupidchicken.com> | 10 | 2009-08-15 Chong Yidong <cyd@stupidchicken.com> |
| 11 | 11 | ||
| 12 | * eval.c (Fcalled_interactively_p, Finteractive_p): Doc | ||
| 13 | fix (Bug#3936). | ||
| 14 | |||
| 12 | * xdisp.c (pop_it): Don't pop into a display vector (Bug#4131). | 15 | * xdisp.c (pop_it): Don't pop into a display vector (Bug#4131). |
| 13 | 16 | ||
| 14 | * buffer.c (set_buffer_internal_1) | 17 | * buffer.c (set_buffer_internal_1) |
diff --git a/src/eval.c b/src/eval.c index 52e3f244047..3427d0f8573 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -586,10 +586,10 @@ usage: (function ARG) */) | |||
| 586 | 586 | ||
| 587 | 587 | ||
| 588 | DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, | 588 | DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, |
| 589 | doc: /* Return t if the function was run directly by user input. | 589 | doc: /* Return t if the containing function was run directly by user input. |
| 590 | This means that the function was called with `call-interactively' | 590 | This means that the function was called with `call-interactively' |
| 591 | \(which includes being called as the binding of a key) | 591 | \(which includes being called as the binding of a key) |
| 592 | and input is currently coming from the keyboard (not in keyboard macro), | 592 | and input is currently coming from the keyboard (not a keyboard macro), |
| 593 | and Emacs is not running in batch mode (`noninteractive' is nil). | 593 | and Emacs is not running in batch mode (`noninteractive' is nil). |
| 594 | 594 | ||
| 595 | The only known proper use of `interactive-p' is in deciding whether to | 595 | The only known proper use of `interactive-p' is in deciding whether to |
| @@ -598,10 +598,10 @@ of using it for any other purpose, it is quite likely that you're | |||
| 598 | making a mistake. Think: what do you want to do when the command is | 598 | making a mistake. Think: what do you want to do when the command is |
| 599 | called from a keyboard macro? | 599 | called from a keyboard macro? |
| 600 | 600 | ||
| 601 | If you want to test whether your function was called with | 601 | To test whether your function was called with `call-interactively', |
| 602 | `call-interactively', the way to do that is by adding an extra | 602 | either (i) add an extra optional argument and give it an `interactive' |
| 603 | optional argument, and making the `interactive' spec specify non-nil | 603 | spec that specifies non-nil unconditionally (such as \"p\"); or (ii) |
| 604 | unconditionally for that argument. (`p' is a good way to do this.) */) | 604 | use `called-interactively-p'. */) |
| 605 | () | 605 | () |
| 606 | { | 606 | { |
| 607 | return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil; | 607 | return (INTERACTIVE && interactive_p (1)) ? Qt : Qnil; |
| @@ -609,14 +609,15 @@ unconditionally for that argument. (`p' is a good way to do this.) */) | |||
| 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, 0, 0, |
| 612 | doc: /* Return t if it is in a function called with `call-interactively'. | 612 | doc: /* Return t if the containing function was called by `call-interactively'. |
| 613 | This is used for implementing advice and other function-modifying | 613 | This includes being called as the binding of a key, or called from a |
| 614 | features of Emacs. | 614 | keyboard macro (unlike `interactive-p'). |
| 615 | 615 | ||
| 616 | The cleanest way to test whether your function was called with | 616 | This function is meant for implementing advice and other |
| 617 | `call-interactively' is by adding an extra optional argument, | 617 | function-modifying features. Instead of using this, it is sometimes |
| 618 | and making the `interactive' spec specify non-nil unconditionally | 618 | cleaner to give your function an extra optional argument whose |
| 619 | for that argument. (`p' is a good way to do this.) */) | 619 | `interactive' spec specifies non-nil unconditionally (\"p\" is a good |
| 620 | way to do this). */) | ||
| 620 | () | 621 | () |
| 621 | { | 622 | { |
| 622 | return interactive_p (1) ? Qt : Qnil; | 623 | return interactive_p (1) ? Qt : Qnil; |