2

I am trying to customize emacs/spacemacs to run a command after a key stroke, like running eslint --fix command on the buffer to fix errors.

I already tried

(defun fix-errors-with-eslint ()
  (shell-command-to-string (format "eslint --fix %s" buffer-file-name)))
(global-set-key (kbd "s-f") 'fix-errors-with-eslint)

but i receive an error: Wrong type argument: commandp, fix-errors-with-eslint

I am an emacs beginner, using only basic spacemacs and its layers, any help appreciated.

1 Answers1

3

Try adding (interactive) as the first line in your function definition. That will make it a command instead of a function.

John Kitchin
  • 11,555
  • 1
  • 19
  • 41