问题描述
在Emacs中,我想定义一个lisp函数来调用其他窗口,其参数为-1,以切换到同一帧中的上一个窗口。根据我最好的研究,应该可以在我的emacs文件中这样做: (defun previous-window )
(interactive)
(other-window -1))
当我运行这个功能时:
Mx上一个窗口
我得到这个:
参数数量错误:(lambda nil (互动)(其他窗口-1)),3
另外,奇怪的是,现在当我做这个:
Cu - Cx o
我得到:
参数数量错误:(lambda nil(interactive)窗口-1)),3
如果我从我的emacs文件中删除上述函数定义,并做这个:
Cu - Cx o
行为是如预期的。
似乎没有以前的定义在emacs中。
在这里抓我的头。
你可以使用 Cu-C xo
(其中 C xo
是 other-窗口
,但您的更长的 Mx其他窗口
方法也是如此),因为 -
本身表示一个数字前缀参数-1。
In Emacs, I would like to define a lisp function to call other-window with an argument of -1 in order to switch to the previous window in the same frame. According to my best research, it should be possible to do this as follows in my emacs file:
(defun previous-window ()
(interactive)
(other-window -1))
However, when I run the function:
M-x previous-window
I get this:
Wrong number of arguments: (lambda nil (interactive) (other-window -1)), 3
Also, weirdly, now when I do this:
C-u - C-x o
I get:
Wrong number of arguments: (lambda nil (interactive) (other-window -1)), 3
If I remove the above function definition from my emacs file, and do this:
C-u - C-x o
the behavior is as expected.
There does not seem to be a previous definition of previous-window in emacs.
Scratching my head here.
You can use C-u - C x o
(where C x o
is the normal key binding for other-window
, but your longer M-x other-window
approach works as well), as -
by itself indicates a numeric prefix argument of -1.
这篇关于Emacs定义函数使用参数调用其他窗口不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!