File: emacs-format-js.el

package info (click to toggle)
js-of-ocaml 2.5-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,816 kB
  • ctags: 7,597
  • sloc: ml: 40,337; makefile: 731; lisp: 41; sh: 14; ruby: 4; perl: 4
file content (30 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;;; File: emacs-format-file
;;; Stan Warford
;;; 17 May 2006

(setq js-indent-level 2)
(custom-set-variables
 '(indent-tabs-mode nil)
 '(tab-width 2))

(defun emacs-format-js ()
  "Format the whole buffer."
  (js-mode)
  (indent-region (point-min) (point-max) nil)
  (delete-trailing-whitespace)
  (save-buffer)
  )

(defun emacs-format-js-ident ()
  "Format the whole buffer."
  (js-mode)
  (indent-region (point-min) (point-max) nil)
  (save-buffer)
  )

(defun emacs-format-js-clean ()
  "Format the whole buffer."
  (js-mode)
  (delete-trailing-whitespace)
  (save-buffer)
)