This is something I stole from Phil Hagelberg's starter kit. It doesn't work all the time, and in some cases might do some things you don't particularly want, but I still use it:
(defun untabify-buffer () (interactive) (untabify (point-min) (point-max))) (defun indent-buffer () (interactive) (indent-region (point-min) (point-max))) (defun cleanup-buffer () "perform a bunch of operations on the whitespace content of a buffer" (interactive) (indent-buffer) (untabify-buffer) (delete-trailing-whitespace)) (global-set-key (kbd "C-c n") 'cleanup-buffer) The other thing you can do is mark the region you want to clean up and hit TAB. It does most of what you want. Cheers, -- Devin Walters On Friday, February 7, 2014 at 4:20 PM, Taylor Sando wrote: > Let us say you had this: > > (defn create-new-canvas-text [inputs] > (let [{text-selected-id :new} (dataflow/old-and-new inputs [:design :params > :text :selected-id]) > {text-params :new} (dataflow/old-and-new inputs [:design :params > :text]) > text-value (:value text-params) > > ] > ;; When there is no previous selected id and there is now non-empty text > in the params text > ;; it means that a new canvas text entry should occur > (when > (and (nil? text-selected-id) (not (empty? text-value))) > ;; Get the previous text entries in canvas > ;; Create a new key, which will become selected-id > ;; Add the new text entries into canvas > (let [{prev-text :new} (dataflow/old-and-new inputs > [:design :canvas :text]) > old-keys (keys prev-text) > new-id (if (seq old-keys) (inc (apply max (keys old-keys))) 0) > new-text (assoc old-keys new-id (select-keys text-params > [:value]))] > [ > ^:input {msg/topic [:design :params :text :selected-id] msg/type > :set-value :value new-id} > ^:input {msg/topic [:design :canvas :text] msg/type :set-value > :value new-text}])) > > > ) > > ) > > Is there a way to get it into this: > > (defn create-new-canvas-text [inputs] > (let [{text-selected-id :new} (dataflow/old-and-new inputs [:design :params > :text :selected-id]) > {text-params :new} (dataflow/old-and-new inputs [:design :params > :text]) > text-value (:value text-params)] > ;; When there is no previous selected id and there is now non-empty text > in the params text > ;; it means that a new canvas text entry should occur > (when (and (nil? text-selected-id) (not (empty? text-value))) > ;; Get the previous text entries in canvas > ;; Create a new key, which will become selected-id > ;; Add the new text entries into canvas > (let [{prev-text :new} (dataflow/old-and-new inputs [:design :canvas > :text]) > old-keys (keys prev-text) > new-id (if (seq old-keys) (inc (apply max (keys old-keys))) 0) > new-text (assoc old-keys new-id (select-keys text-params > [:value]))] > [^:input {msg/topic [:design :params :text :selected-id] msg/type > :set-value :value new-id} > ^:input {msg/topic [:design :canvas :text] msg/type :set-value > :value new-text}])))) > > > > Seems like it would be a combination of indent-sexp, and then identifying > unnecessary white space and deleting it. > > -- > 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 > (mailto: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 > (mailto: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 > (mailto:clojure+unsubscr...@googlegroups.com). > For more options, visit https://groups.google.com/groups/opt_out. -- 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.