Create a gist now

Instantly share code, notes, and snippets.

beautify some js code in emacs
;;; js-beautify.el -- beautify some js code
(defgroup js-beautify nil
"Use jsbeautify to beautify some js"
:group 'editing)
(defcustom js-beautify-args "--jslint-happy --brace-style=end-expand --keep-array-indentation"
"Arguments to pass to jsbeautify script"
:type '(string)
:group 'js-beautify)
(defcustom js-beautify-path "~/projects/js-beautify/python/"
"Path to jsbeautifier python file"
:type '(string)
:group 'js-beautify)
(defun js-beautify ()
"Beautify a region of javascript using the code from"
(let ((orig-point (point)))
(unless (mark)
(shell-command-on-region (point)
(concat "python "
" --stdin "
nil t)
(goto-char orig-point)))
(provide 'js-beautify)
;;; js-beautify.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment