Fork me on GitHub
#emacs
<
2017-05-09
>
richiardiandrea00:05:32

@qqq try clojure-align

qqq00:05:57

should I bind this to a hot key or to have it run after every return ?

qqq00:05:51

so clojure-align works for let/case, but not for 'match'

qqq00:05:00

how do I hack it to extend clojure-align to also work on 'match' ?c

richiardiandrea00:05:54

don't about ux, i use it very rarely. about the last question, probably the answer is to open an issue in clojure-mode

qqq00:05:50

i was lookinat at source code

qqq00:05:55

but can't find the var where let/case is defined

qqq00:05:05

I expect it to be something I can fix in 1 line if only I can find the right var 🙂

bozhidar05:05:41

Btw, you're not really supposed to use this as an interactive command - there a defcustom that enables this alignment by default.

bozhidar05:05:59

clojure-align-forms-automatically

bozhidar05:05:49

@richiardiandrea I'll cut a new version of inf-clojure once this patch is merged

bozhidar05:05:04

I wonder why no one reported this in over a week, though

qqq06:05:21

@bozhidar : very nice; thanks!

borkdude11:05:38

I want to add a ‘before-save-hook to indent my Clojure code. How do I add this for only Clojure files?

bozhidar13:05:49

You can simply check the mode in the hook. Or create a local hook.

adamfrey15:05:28

I was dealing with the inf-clojure problem for a week, but I didn’t get around to reporting it until yesterday. Maybe others hadn’t updated their packages?

ballpointcarrot16:05:23

@borkdude another option (depending) is https://github.com/Malabarba/aggressive-indent-mode , which indents after any buffer change (that’s better or worse depending on how you feel about it)

borkdude18:05:29

One of the problems with automatic indentation on save is that in some files indentation becomes tediously slow on my machine (a few seconds). Don’t know exactly why this is, it’s not in all files.

qqq18:05:56

clojure align is beautiful

qqq19:05:03

I can't believe I ever lived without it

jakemcc20:05:54

I used aggressive-indent-mode for a long time and found myself needing to turn it off with long files. Eventually I turned it off completely and was amazed at how much smoother the editing experience was.

ghosss22:05:18

@borkdude this is how I've been indenting on save for clojure (and elisp) files:

(defvar auto-indent-modes
  '(clojure-mode emacs-lisp-mode))

(defun indent-maybe ()
  (when (member major-mode auto-indent-modes)
    (indent-region (point-min) (point-max))))

(add-hook 'before-save-hook #'indent-maybe)