Skip to content

Instantly share code, notes, and snippets.

@fgui
Created April 12, 2016 06:17
Show Gist options
  • Save fgui/9b44a9f0bd1f3787a4580a18e7a39dc7 to your computer and use it in GitHub Desktop.
Save fgui/9b44a9f0bd1f3787a4580a18e7a39dc7 to your computer and use it in GitHub Desktop.
format clj on save cider/emacs
;; it formats buffer and attempts to return to original position.
(defun cider-format-buffer-back () (interactive)
(let (p)
(setq p (point))
(cider-format-buffer)
(goto-char p))
)
(defun add-clj-format-before-save () (interactive)
(add-hook 'before-save-hook
'cider-format-buffer-back
t t))
(add-hook 'clojure-mode-hook
'add-clj-format-before-save)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment