简体   繁体   English

如何在elisp程序中调用函数,并按照交互路径?

[英]How to call a function in an elisp program, and follow the interactive path?

If I call ispell-check-version interactively (through Mx ) it got this answer: 如果我以交互方式调用ispell-check-version (通过Mx ),它得到了这个答案:

@(#) International Ispell Version 3.3.02 12 Jun 2005, ispell.el 3.6 - 7-Jan-2003 @(#)International Ispell Version 3.3.02 2005年6月12日,ispell.el 3。6 - 7-Jan-2003

Fine. 精细。 Now let's say I want to call it from a program. 现在让我们说我想从程序中调用它。 I expect to get the same result. 我希望得到相同的结果。 But the function behaves differently when not call interactively. 但是当不以交互方式调用时,函数的行为会有所不同。 Its documentation tells so, and indeed it does. 它的文档说明了,事实确实如此。 Let's try in the *scratch* buffer (evaluated with Cu Cx Ce ): 让我们尝试*scratch*缓冲区(用Cu Cx Ce评估):

(ispell-check-version)

returns me : "/opt/local/lib" !! 给我回复:“/ opt / local / lib”!! Not exepected.. How can I make the function behaves and the return the same result now that I call it "programatically" as when I was calling it "interactively" please? 没有被考虑..如果我以“编程方式”称它为“交互式地”,请如何使函数表现并返回相同的结果?

call-interactively是您正在寻找的。

(call-interactively 'ispell-check-version)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM