Created
April 25, 2018 08:28
-
-
Save volh/b3d3a8358eb941610edd47eadbf9770c to your computer and use it in GitHub Desktop.
Call prettier.js on current emacs buffer file
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 shell-command-on-buffer (command) | |
"run a command on the current file and revert the buffer" | |
(interactive "sCommand:") | |
(shell-command | |
(format "%s %s" | |
command | |
(shell-quote-argument (buffer-file-name)))) | |
(revert-buffer t t t)) | |
(defun prettier-js-on-buffer () | |
(interactive) | |
(shell-command-on-buffer "prettier --write")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment