(defun my/cleanup-buffer ()
  (interactive)
  (delete-trailing-whitespace)
  (untabify (point-min) (point-max))
  (indent-region (point-min) (point-max)))

(global-set-key (kbd "C-c n") 'my/cleanup-buffer)
(global-set-key (kbd "C-c C-n") 'my/cleanup-buffer)

(defun my/cleanup-buffer ()
  (interactive)
  (delete-trailing-whitespace)
  (untabify (point-min) (point-max))
  (indent-region (point-min) (point-max))
  (when (derived-mode-p 'clojure-mode)
    (clojure-sort-ns)))

(global-set-key (kbd "C-c n") 'my/cleanup-buffer)
(global-set-key (kbd "C-c C-n") 'my/cleanup-buffer)

Sort clojure ns forms on buffer cleanup.
Sort clojure ns forms on buffer cleanup.

pjstadig/dotfiles,pjstadig/dotfiles