use the 'indent-region' function.You can define a function to indent the whole buffer:
(defun indent-buffer () "Indent whole buffer" (interactive) (indent-region (point-min) (point-max)) (message "format successfully")) Then bind the function to a key, i bound it to F7 for me: (global-set-key [f7] 'indent-buffer) Also, you can indent-buffer before saving file: (defun indent-file-when-save () "indent file when save." (make-local-variable 'after-save-hook) (add-hook 'after-save-hook (lambda () (if (buffer-file-name) (indent-buffer)) (save-buffer)))) (add-hook 'clojure-mode-hook 'indent-file-when-save) 2014/1/3 tao <tao.zhou2...@gmail.com> > https://github.com/clojure-emacs/clojure-mode > > I have installed this plugin, but I don’t know how to indent clojure code, > when I already selected a region. In Vim, I can do this using “=“, just a > simple key stroke. > > This a problem when I copy some clojure code from other place, not typed > in. > > I already read this tutorial ( > http://www.unexpected-vortices.com/clojure/10-minute-emacs-for-clojure.html), > but I cannot found the method. > > sorry for disturb. :) > > -- > tao > Sent with Sparrow <http://www.sparrowmailapp.com/?sig> > > -- > -- > 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. > -- 庄晓丹 Email: killme2...@gmail.com xzhu...@avos.com Site: http://fnil.net Twitter: @killme2008 -- -- 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.