Commits

Anonymous committed cf1ca8c

Added indent-buffer

Comments (0)

Files changed (2)

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 ()
   (interactive)
   (interactive)
   (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
        (window-list)
        buffers
        start-positions)))
+
+;; TODO: add function to hide function bodies and leave just name and
+;; docstring, useful for quick overview of the package. See
+;; `hs-make-overlay'
 ;; 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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.