I have a function in +bindings.el in .doom.d called jiayuan/org-capture-inbox, and I want to bind it to SPC I, here is my code:
(map! :leader
:desc "Capture Inbox" "I" #'jiayuan/org-capture-inbox
)
;;;###autoload
(defun jiayuan/org-capture-inbox ()
"Direct capture tasks to inbox"
(lambda () (interactive) (org-capture nil "t")))
But when I use this key, I have this error message:
command-execute: Wrong type argument: commandp, jiayuan/org-capture-inbox
And I can't use M-x to run my function. Do I miss something with lazy loading?
The problem is that jiayuan/org-capture-inbox is not an interactive function, it is a function that _returns_ an interactive function. Here's what you want:
(defune jiayuan/org-capture-inbox ()
"Direct capture tasks to inbox"
(interactive)
(org-capture nil "t"))
(map! :leader :desc "Capture Inbox" "I" #'jiayuan/org-capture-inbox)
OR
(map! :leader :desc "Capture Inbox" "I" (lambda () (interactive) (org-capture nil "t")))
OR
(map! :leader :desc "Capture Inbox" "I" (位! (org-capture nil "t")))
@hlissner Thanks, it works now!
Most helpful comment
The problem is that
jiayuan/org-capture-inboxis not an interactive function, it is a function that _returns_ an interactive function. Here's what you want:OR
OR