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.

2

1 Answer 1

3

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

2
  • could you post an example, again, I am a beginner :( Commented May 31, 2017 at 17:16
  • ok, that solve my problem Commented May 31, 2017 at 17:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.