From 964ba0f5261b2de1c5979cef8727cd1663b4438b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Jan 2016 16:54:35 +0200 Subject: [PATCH] Document 'funcall-interactively' * doc/lispref/commands.texi (Interactive Call): Document 'funcall-interactively'. * doc/lispref/functions.texi (Calling Functions): Mention 'funcall-interactively' and provide a cross-reference. --- doc/lispref/commands.texi | 8 ++++++++ doc/lispref/functions.texi | 4 ++++ etc/NEWS | 1 + 3 files changed, 13 insertions(+) diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index dee43cefb15..9c1df895161 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -691,6 +691,14 @@ default is the return value of @code{this-command-keys-vector}. @xref{Definition of this-command-keys-vector}. @end defun +@defun funcall-interactively function &rest arguments +This function works like @code{funcall} (@pxref{Calling Functions}), +but it makes the call look like an interactive invocation: a call to +@code{called-interactively-p} inside @var{function} will return +@code{t}. If @var{function} is not a command, it is called without +signaling an error. +@end defun + @defun command-execute command &optional record-flag keys special @cindex keyboard macro execution This function executes @var{command}. The argument @var{command} must diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index d3d0a422574..1e8e7540395 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -754,6 +754,10 @@ they make sense only when given the unevaluated argument expressions. @code{funcall} cannot provide these because, as we saw above, it never knows them in the first place. +If you need to use @code{funcall} to call a command and make it behave +as if invoked interactively, use @code{funcall-interactively} +(@pxref{Interactive Call}). + @example @group (setq f 'list) diff --git a/etc/NEWS b/etc/NEWS index 01a8490023a..6735718b63c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1467,6 +1467,7 @@ MS-Windows doesn't support UTF-8 as codeset in its locales. +++ ** New function `alist-get', which is also a valid place (aka lvalue). ++++ ** New function `funcall-interactively', which works like `funcall' but makes `called-interactively-p' treat the function as (you guessed it) called interactively. -- 2.39.5