Skip to content

Instantly share code, notes, and snippets.

@mpenet
Created August 10, 2011 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpenet/1138239 to your computer and use it in GitHub Desktop.
Save mpenet/1138239 to your computer and use it in GitHub Desktop.
(defun compile-cljs-on-after-save-hook ()
(add-hook 'after-save-hook
'(lambda ()
(interactive)
(let* ((file-name (buffer-file-name))
(file-name-dir (file-name-directory file-name)))
(if (string-match "\.cljs$" file-name)
(async-shell-command
(concat "cljsc " file-name-dir
;; " '{:optimizations :advanced}' > "
;; file-name-dir "compiled.js"
) nil nil))))))
(add-hook 'clojure-mode-hook 'compile-cljs-on-after-save-hook)
(setq auto-mode-alist (cons '("\\.cljs$" . clojure-mode) auto-mode-alist))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment