当我按下C-c c
在缓冲区中使用以下代码,Emacs 会抱怨Invalid function: (select-current-line)
. Why?
(defun select-current-line ()
"Select the current line"
(interactive)
(end-of-line) ; move to end of line
(set-mark (line-beginning-position)))
(defun my-isend ()
(interactive)
(if (and transient-mark-mode mark-active)
(isend-send)
((select-current-line)
(isend-send)))
)
(global-set-key (kbd "C-c c") 'my-isend)
这并不重要,但对于那些感兴趣的人来说isend-发送 https://github.com/emacsmirror/isend-mode在这里定义。
你缺少一个progn
将语句分组在一起的形式:
(defun my-isend ()
(interactive)
(if (and transient-mark-mode mark-active)
(isend-send)
(progn
(select-current-line)
(isend-send))))
如果没有progn
form, ((select-current-line) (isend-send))
被解释为(select-current-line)
函数应用于调用结果isend-send
没有争论。但(select-current-line)
不是有效的函数名称。在其他 LISP 中,如果返回值是,这样的构造可能是有效的select-current-line
本身就是一个函数,然后将其应用于(isend-send)
。但这不是 Emacs LISP 的情况,无论如何这都不会实现您想要实现的目标......
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)