[英]How to understand this form (interactive (list 'interactive)) in Emacs Lisp?
I was found some codes like this, 我找到了一些这样的代码,
1 (require 'cl-lib)
2 (require 'company)
3
4 (defun company-sample-backend (command &optional arg &rest ignored)
5 (interactive (list 'interactive))
...
)
but how to understand line 5? 但如何理解第5行?
The argument to the interactive
declaration is either a string or an elisp form which, when evaluated, returns a list of argument values for the function. interactive
声明的参数是字符串或elisp表单,在计算时,它返回函数的参数值列表 。
In this instance the declaration uses a form returning a list. 在这种情况下,声明使用返回列表的表单。 The form is:
表格是:
(list 'interactive)
which is a form that returns a list of a single item, being the symbol interactive
这是一个返回单个项目列表的表单,是
interactive
符号
The argument list for the function was: 该函数的参数列表是:
(command &optional arg &rest ignored)
Therefore, when this function is called interactively, the argument command
will have the value interactive
因此,当以交互方式调用此函数时,参数
command
将具有interactive
值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.