@Feng It doesn't clean up the way John is looking to clean some code like this:
(defun func1 [a b c d] (func5 (let [f (func3 c)] (func2 a b f)) (let > [e 5] (func4 c d e)))) > On Tue, Feb 12, 2013 at 9:11 AM, Feng Shen <shen...@gmail.com> wrote: > > (defun indent-buffer () > (interactive) > (indent-region (point-min) (point-max))) > (defun cleanup-buffer () > (interactive) > (indent-buffer) > (untabify-buffer) > (delete-trailing-whitespace)) > ;; bind to other key if you like(global-set-key (kbd "M-q") 'cleanup-buffer) > > > cleanup-buffer is very fast, I hit it all the time. > > > > On Tuesday, February 12, 2013 10:28:43 AM UTC+8, John Fries wrote: >> >> Clojure Users, >> >> I'm relatively new to clojure and wanted to get some workflow advice. >> >> I often find myself staring at something like this: >> (defun func1 [a b c d] (func5 (let [f (func3 c)] (func2 a b f)) (let >> [e 5] (func4 c d e)))) >> >> and wishing for a function to automatically and idiomatically break it >> up into multiple lines and indent it: >> (defun func1 [a b c d] >> (func5 >> (let [f (func3 c)] >> (func2 a b f)) >> (let [e 5] >> (func4 c d e)))) >> >> I find the latter form more readable, but inserting the newlines by >> hand is getting repetitive (also, I am not always confident in my >> choice of idiomatic breakpoints). Once I insert the newlines, I can >> trigger auto-indentation by hitting M-q (which on my system is mapped >> to paredit-reindent-defun) or by highlighting the region and hitting >> M-C-\ (which on my system is indent-region). >> >> My question(s) is: >> How are people currently handling this situation? Is it part of most >> people's clojure/emacs workflow to >> 1) Just insert the newlines by hand? (perhaps I'm the only one finding >> this repetitive) >> 2) Do people have some accepted pretty printing function they are >> using within emacs? >> 3) Is there some larger issue I'm not seeing that maybe makes this >> whole idea irrelevant? >> >> I've seen this document: >> http://richhickey.github.com/**clojure/doc/clojure/pprint/** >> PrettyPrinting.html<http://richhickey.github.com/clojure/doc/clojure/pprint/PrettyPrinting.html> >> But I haven't found any guide to using that function *within emacs*. >> If this is not a common thing to do, then why is it not common? >> >> Thanks, >> John >> >> caveat: My init.el is an amalgam of ideas from ESK, prelude and emacs >> live, so it could be the case that this functionality is provided out >> of the box, if only I were configured properly. If people have some >> way of doing this in their emacs environment, a clue as to the kit or >> configuration you are using would be very much appreciated. >> > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Mayank. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.