uris77
10/6/2015 - 3:45 PM

Emacs Tips for Clojure

Emacs Tips for Clojure

  • Move to previous function beginning-of-defun
  • Move to next function next-defun where :
(defun next-defun ()
  (interactive)
  (end-of-defun 2)
  (beginning-of-defun 1))
  • Repeat a character n times with C-u n <character>. For example, to insert ; 50 times:
C-u 50 ;

Functions for aligning text:

(defun bjm/align-whitespace (start end)
  "Align columns by whitespace"
  (interactive "r")
  (align-regexp start end
                "\\(\\s-*\\)\\s-" 1 0 t))

(defun bjm/align-& (start end)
  "Align columns by ampersand"
  (interactive "r")
  (align-regexp start end
                "\\(\\s-*\\)&" 1 1 t))

Increase Text Size: C-x C-+ Decrease Text Size: C-x C-- Reset Text Size: C-x C-0

Add indentation support for om.next:

(define-clojure-indent
  (defui '(1 :form (:defn))))