Created
October 18, 2016 15:30
-
-
Save aaronjensen/dbc6eb6fa01daf62fcdc1947347fe2eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun eslint-fix () | |
(interactive) | |
(let ((current-point (point))) | |
(unless (eq 0 | |
(shell-command-on-region | |
;; Region | |
(point-min) | |
(point-max) | |
;; Command | |
(concat | |
"eslint_d" | |
" --stdin" | |
" --fix-to-stdout" | |
" --stdin-filename " buffer-file-name) | |
;; Output to current buffer | |
(current-buffer) | |
;; Replace buffer | |
t | |
;; Error buffer name | |
"*eslint-fix error*" | |
;; Display error buffer | |
t)) | |
(undo)) | |
;; Refresh syntax highlighting | |
(font-lock-fontify-buffer) | |
(goto-char current-point))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment