From 56822a900cb3e8d3d80cf97a4e9c87bdc4b9596e Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 28 Mar 2013 12:20:42 +0100 Subject: Emacs: Add indent-defun Found at: http://emacsredux.com/blog/2013/03/28/indent-defun/ --- emacs/init.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'emacs/init.org') 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)) -- cgit v1.2.3-54-g00ecf