(互动)在Emacs Lisp函数中是什么意思? [英] What does (interactive) mean in an Emacs Lisp function?

查看:97
本文介绍了(互动)在Emacs Lisp函数中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Emacs Lisp函数通常开始如下:

Emacs Lisp function often start like this:

(lambda () (interactive) ...

(交互式)做什么?

推荐答案

只是为了澄清(这是在引用的文档查理引用(interactive)不仅仅是用于键绑定函数,而是用于任何函数,没有(交互式),它只能以编程方式调用,而不能从 Mx (或通过键盘绑定)。

Just to clarify (it is in the quoted docs that Charlie cites) (interactive) is not just for key-bound functions, but for any function. Without (interactive), it can only be called programmatically, not from M-x (or via key-binding).

编辑:请注意,只要在函数中添加(interactive)就不一定会使其工作,无论是 - 功能都不会有很多原因交互式,范围界定,依赖关系,参数等。

Note that just adding "(interactive)" to a function won't necessarily make it work that way, either -- there could be many reasons functions are not interactive. Scoping, dependencies, parameters, etc.

这篇关于(互动)在Emacs Lisp函数中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆