summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2013-03-28 12:20:42 +0100
committerGravatar Tom Willemsen2013-03-28 12:20:42 +0100
commit56822a900cb3e8d3d80cf97a4e9c87bdc4b9596e (patch)
treecf3ec0d9f87243c256b08ef35e4534106607fc7c
parent85100905e4842b5f3ba779e308b36d1e2abc806d (diff)
downloaddotfiles-56822a900cb3e8d3d80cf97a4e9c87bdc4b9596e.tar.gz
dotfiles-56822a900cb3e8d3d80cf97a4e9c87bdc4b9596e.zip
Emacs: Add indent-defun
Found at: http://emacsredux.com/blog/2013/03/28/indent-defun/
-rw-r--r--emacs/init.org16
1 files changed, 16 insertions, 0 deletions
diff --git a/emacs/init.org b/emacs/init.org
index a41452b..0a72b5c 100644
--- a/emacs/init.org
+++ b/emacs/init.org
@@ -524,6 +524,22 @@ them immediately, they take a little time to load.
(eval-after-load "org" '(require 'org-init))
#+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
(eval-after-load "rainbow-mode" '(oni:rainbow-mode-init))
(eval-after-load "smex" '(oni:smex-init))