我想写一个Emacs函数来调用describe-function的current-word.如果没有命名的函数current-word则调用describe-variable.
我试着写,但我连打电话describe-function的current-word...
(defun describe-function-or-variable ()
(interactive)
(describe-function `(current-word)))
Run Code Online (Sandbox Code Playgroud)
我怎么写呢?
这样的事情应该有效:
(defun describe-function-or-variable ()
(interactive)
(let ((sym (intern-soft (current-word))))
(cond ((null sym)
"nothing")
((functionp sym)
(describe-function sym))
(t
(describe-variable sym)))))
Run Code Online (Sandbox Code Playgroud)