hydra
hydra copied to clipboard
"Wrong type argument: commandp, ......." when call function through hydra
I have a hydra like this
(global-set-key (kbd "<escape>") 'hydra-edit-panel/body)
(defhydra hydra-edit-panel (:hint nil :exit t )
"Edit Panel"
;; Mark
("mw" mark-word-at-point)
("me" mark-expresiion-at-point)
("ml" mark-indented-line-at-point)
)
and difinition with these funcitons
(defun mark-text-object-at-point (next prev)
"First go to the end of the text object with funciton NEXT and set mark and than go back to the beginning of the text object with function PREV and complete the mark."
;; Notice: f means go next, b means prev
(funcall next nil)
(set-mark-command nil)
(funcall prev))
(defun mark-word-at-point ()
"Mark the word where the cursor at, if the cursor just between two word, than mark the word previos to the cursor."
(interactive)
(mark-text-object-at-point 'forward-word 'backward-word))
(defun mark-idented-line-at-point()
"Mark the idented line where the cursor at."
(interactive)
(mark-text-object-at-point 'move-end-of-line 'back-to-indentation))
and mark-word-at-point
works well with ESC mw
but when it comes to mark-indented-line-at-point
I can call it by M-x mark-indented-line-at-point
and get
Wrong type argument: commandp, mark-indented-line-at-point
after ESC ml
Any suggestion?
mark-indented-line-at-point
This function does not exist. I don't have it either.
The function is defined by me, can call it with M-x
Well, you need to load that function with e.g. C-x C-e or C-M-x.
I get the same error message even after I restarted my Emacs and evaluated both my hydra function and mark-indented-line-at-point
with both 'C-x C-e' and 'C-M-x'
@frankie8518 @abo-abo i think this might happen when the function isn't (interactive)
.
@therockmandolinist
Though mark-indented-line-at-point
use a not interactive function mark-text-object-at-point
but it is interactive itself. And I could find it with M-x
.
@frankie8518 oh, nevermind, i didn't see that. my bad