2

This question already has an answer here:

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.

marked as duplicate by Drew, Community May 31 '17 at 17:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

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

  • could you post an example, again, I am a beginner :( – Daniel Pérez May 31 '17 at 17:16
  • ok, that solve my problem – Daniel Pérez May 31 '17 at 17:26
  • but this question is duplicated – Daniel Pérez May 31 '17 at 17:27

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