I want to write an Emacs function that calls describe-function
for current-word
. And if there is no function named current-word
then it calls describe-variable
.
I tried to write it, but I couldn't even call describe-function
for current-word
...
(defun describe-function-or-variable ()
(interactive)
(describe-function `(current-word)))
How can I write it?
Something like this should work:
(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)))))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With