Emacs: Add indent-defun

Found at: http://emacsredux.com/blog/2013/03/28/indent-defun/
This commit is contained in:
Tom Willemsen 2013-03-28 12:20:42 +01:00
parent 85100905e4
commit 56822a900c

View file

@ -524,6 +524,22 @@ them immediately, they take a little time to load.
(eval-after-load "org" '(require 'org-init)) (eval-after-load "org" '(require 'org-init))
#+END_SRC #+END_SRC
Found on [[http://emacsredux.com/blog/2013/03/28/indent-defun/][Indent defun - Emacs Redux]], indents a function. Should be
just a tiny bit easier than going to the beginning of a function and
then calling =indent-sexp=, which only works in lisp-like languages
anyway.
#+BEGIN_SRC emacs-lisp
(defun indent-defun ()
"Indent the current defun."
(interactive)
(save-excursion
(mark-defun)
(indent-region (region-beginning) (region-end))))
(global-set-key (kbd "C-M-z") 'indent-defun)
#+END_SRC
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) (eval-after-load "rainbow-mode" '(oni:rainbow-mode-init))
(eval-after-load "smex" '(oni:smex-init)) (eval-after-load "smex" '(oni:smex-init))