我想让这个函数设置键绑定更短。
(defun defkey-arg2 ()
(exwm-input-set-key (kbd "s-g")
(lambda ()
(interactive)
(start-process-shell-command gkamus nil gkamus))))
然后我用 2 个参数(键绑定和应用程序名称)编写更短的函数
(defun defkey-arg2 (key command) (...)
当我尝试将密钥作为参数时,它将起作用
(defun defkey-arg2 (key)
(exwm-input-set-key (kbd key)
(lambda ()
(interactive)
(start-process-shell-command gkamus nil gkamus))))
(defkey-arg2 "s-g")
但是,当我尝试编写这样的函数时
(defun defkey-arg2 (key command)
或者
(defun defkey-arg2 (command)
(exwm-input-set-key (kbd "s-g")
(lambda ()
(interactive)
(start-process-shell-command command nil command)))
(defkey-arg2 "gkamus")
它引发错误:
Symbol's value as variable is void:' when using parameter on defun