general.el icon indicating copy to clipboard operation
general.el copied to clipboard

general-key-dispatch - the function ‘general-dispatch-self-insert-command-0’ is not known to be defined

Open garrett-hopper opened this issue 5 years ago • 0 comments

I'm using general-key-dispatch like this

(general-def 'insert
  "j" (general-key-dispatch 'self-insert-command
        :timeout 0.3
        "j" 'evil-normal-state))

Whenever the file is byte-compiled (by Flycheck), I get this error: the function ‘general-dispatch-self-insert-command-0’ is not known to be defined.

It looks like this is due to the macro expansion of general-key-dispatch having a defun inside of progn.

Is there any way around this?

(general-def 'insert
  "j" (progn
        (defun example ())
        #'example))

results in the function ‘example’ is not known to be defined.

Perhaps general-key-dispatch can be changed to be byte-compile friendly?

It looks like declare-function isn't the solution, because the function isn't defined in the root of a file but a macro expansion.

garrett-hopper avatar Dec 07 '19 22:12 garrett-hopper