Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tools: formating script

formating scritp

fix script

fix script
  • Loading branch information...
commit 05a05424ec452f35464cc6266cfd40d36b88bbca 1 parent 90e06eb
@hhugo hhugo authored
View
2  .ocp-indent
@@ -0,0 +1,2 @@
+normal
+syntax=lwt mll
View
30 tools/emacs-format-js.el
@@ -0,0 +1,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)
+)
View
24 tools/emacs-format-ocaml.el
@@ -0,0 +1,24 @@
+;;; File: emacs-format-file
+;;; Stan Warford
+;;; 17 May 2006
+
+(defun emacs-format-function ()
+ "Format the whole buffer."
+ (tuareg-mode)
+ (indent-region (point-min) (point-max) nil)
+ (delete-trailing-whitespace)
+ (save-buffer)
+ )
+
+(defun emacs-format-function-ident ()
+ "Format the whole buffer."
+ (tuareg-mode)
+ (indent-region (point-min) (point-max) nil)
+ (save-buffer)
+ )
+
+(defun emacs-format-function-clean ()
+ "Format the whole buffer."
+ (delete-trailing-whitespace)
+ (save-buffer)
+ )
View
9 tools/format-js.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+echo "# Removing tabs"
+find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*.js" -exec sed -i 's/ //g' {} \;
+
+echo "# Indent files"
+SCRIPT=$(readlink -f $0)
+SCRIPTPATH=`dirname $SCRIPT`
+find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*.js" -exec emacs -batch {} -l ${SCRIPTPATH}/emacs-format-js.el -f emacs-format-js \;
View
12 tools/format-ocaml.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+echo "# Removing tabs"
+find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*\.ml[il]?" -exec sed -i 's/ //g' {} \;
+
+echo "# Whitespace"
+SCRIPT=$(readlink -f $0)
+SCRIPTPATH=`dirname $SCRIPT`
+find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*\.ml[il]?" -exec emacs -batch {} -l ${SCRIPTPATH}/emacs-format-ocaml.el -f emacs-format-function-clean \;
+
+echo "# Indent files"
+find ./ -regex "^\.\(/[a-zA-Z0-9_-.]*\)*\.ml[il]?" -exec ocp-indent -i {} \;
Please sign in to comment.
Something went wrong with that request. Please try again.