[英]Emacs Defining Function Calling other-window with an Argument Doesn't Work
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. 在Emacs中,我想定义一个lisp函数来调用参数为-1的other-window,以便切换到同一帧中的上一个窗口。 According to my best research, it should be possible to do this as follows in my emacs file:
根据我的最佳研究,应该可以在我的emacs文件中执行以下操作:
(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: 如果我从emacs文件中删除上述函数定义,然后执行以下操作:
C-u - C-x o
the behavior is as expected. 行为符合预期。
There does not seem to be a previous definition of previous-window in emacs. emacs中似乎没有对上一个窗口的先前定义。
Scratching my head here. 在这里挠头。
您可以使用Cu - C xo
(其中C xo
是other-window
的常规键绑定,但是您使用的更长的Mx other-window
方法也可以使用),因为-
本身表示数字前缀参数-1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.