Anonymous committed cf1ca8c

Added indent-buffer

  • Participants
  • Parent commits 03af1ee

Comments (0)

Files changed (2)

File files/defuns-buffer.el

              (setq n (1+ n))
              (get-buffer bufname)))
     (switch-to-buffer (get-buffer-create bufname))
-    (emacs-lisp-mode)
-    ))
+    (emacs-lisp-mode)))
 (defun untabify-buffer ()
   (indent-region (point-min) (point-max)))
+(defun indent-defun ()
+  "Indent the current defun."
+  (interactive)
+  (save-restriction
+    (widen)
+    (narrow-to-defun)
+    (indent-buffer)))
 (defun cleanup-buffer-safe ()
   "Perform a bunch of safe operations on the whitespace content of a buffer.
 Does not indent buffer, because it is used for a before-save-hook, and that
+;; TODO: add function to hide function bodies and leave just name and
+;; docstring, useful for quick overview of the package. See
+;; `hs-make-overlay'

File files/keys.el

 ;; Indenting and alignment
 (bind-key "<f8>" 'align-regexp)
 (bind-key "C-<f8>" 'indent-buffer)
+(bind-key "C-<tab>" 'indent-defun)
 ;; shell pop
 (bind-key "<f9>" 'shell-pop)
 ;; ibuffer > list-buffers
 (bind-key "C-x C-b" 'ibuffer)
 (bind-key "C-<m-key>" 'ido-switch-buffer)
+(bind-key "C-x C-k" 'kill-buffer-and-window)
 ;; buffer cleanup
 (bind-key "C-c u" 'cleanup-buffer)