Skip to content

Instantly share code, notes, and snippets.

@malcolmsparks
Created February 18, 2011 08:54
Show Gist options
  • Save malcolmsparks/833433 to your computer and use it in GitHub Desktop.
Save malcolmsparks/833433 to your computer and use it in GitHub Desktop.
Closeup closing parens in Clojure files - put in starter-kit-defuns.el if using the emacs starter kit
;;
;; Author: Malcolm Sparks
(defun closeup-parens ()
(interactive)
(save-excursion
(replace-regexp "[ \t\n]+)" ")" nil (point-min) (point-max))
(replace-regexp "([ \t\n]+" "(" nil (point-min) (point-max))
(replace-regexp "[ \t\n]+}" "}" nil (point-min) (point-max))
(replace-regexp "[ \t\n]+]" "]" nil (point-min) (point-max))
))
(defun cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer."
(interactive)
(indent-buffer)
(untabify-buffer)
(closeup-parens)
(delete-trailing-whitespace))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment