forked from fayland/perl-javascript-beautifier
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathemacs.txt
More file actions
17 lines (16 loc) · 655 Bytes
/
emacs.txt
File metadata and controls
17 lines (16 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;;; JS beautifier functions
(defun js-beautify-region ()
"Run js-beautify on the current region."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark) "js_beautify.pl -s 2 -r -" nil t)
(javascript-mode)))
(defun js-beautify-buffer ()
"Run js-beautify on buffer"
(interactive)
(let ((p (point)))
(save-excursion
(shell-command-on-region (point-min) (point-max) "js_beautify.pl -s 2 -r -" nil t)
)
(goto-char p)
(javascript-mode)))