Created
February 20, 2014 21:02
-
-
Save grimradical/9123149 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for f in $*; do | |
echo $f | |
emacs -batch "$f" -l ~/.emacs -l ~/local/bin/emacs-format-file -f emacs-format-function | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ~/local/bin/emacs-format-file | |
(defun align-buffer () | |
"Align expressions in the whole buffer" | |
(end-of-buffer) | |
(beginning-of-line) | |
(setq morelines t) | |
(while morelines | |
(condition-case exc | |
(align-cljlet) | |
('error nil) | |
) | |
(setq morelines (= 0 (forward-line -1))))) | |
(defun emacs-format-function () | |
"Format the whole buffer." | |
(clojure-mode) | |
(indent-region (point-min) (point-max)) | |
(align-buffer) | |
(untabify (point-min) (point-max)) | |
(delete-trailing-whitespace) | |
(save-buffer)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment