Skip to content

Instantly share code, notes, and snippets.

@volh
Created April 25, 2018 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volh/b3d3a8358eb941610edd47eadbf9770c to your computer and use it in GitHub Desktop.
Save volh/b3d3a8358eb941610edd47eadbf9770c to your computer and use it in GitHub Desktop.
Call prettier.js on current emacs buffer file
(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