]> gitweb.michael.orlitzky.com - emacs.d.git/commitdiff
Added a dired-mode-hook.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 15 Apr 2010 19:54:09 +0000 (15:54 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 24 Mar 2011 00:46:49 +0000 (20:46 -0400)
mode-hooks.el
mode-hooks/dired-mode-hooks.el [new file with mode: 0644]

index 679909e6027f9d2aea8006b9712d26ca7f1544ac..5ce108c32c59126d0cec92e88c9fc71f8d3d6321 100644 (file)
@@ -1,6 +1,7 @@
 (add-to-list 'load-path "~/.home/emacs/mode-hooks/")
 
 (load-library "basic-mode-hooks")
+(load-library "dired-mode-hooks")
 (load-library "nxml-mode-hooks")
 (load-library "css-mode-hooks")
 (load-library "ruby-mode-hooks")
diff --git a/mode-hooks/dired-mode-hooks.el b/mode-hooks/dired-mode-hooks.el
new file mode 100644 (file)
index 0000000..80efd0b
--- /dev/null
@@ -0,0 +1,18 @@
+(defun dired-up-directory-in-same-buffer ()
+  ;; Open the parent directory, but do it in the current buffer.
+  (interactive)
+  (find-alternate-file "..")
+)
+
+(defun dm-hook()
+  ;; Redefine some functions so that dired will re-use the current
+  ;; buffer whenever possible.
+  
+  ;; Was dired-advertised-find-file.
+  (define-key dired-mode-map (kbd "<return>") 'dired-find-alternate-file)
+
+  ;; Was dired-up-directory.
+  (define-key dired-mode-map (kbd "^") 'dired-up-directory-in-same-buffer)
+)
+
+(add-hook 'dired-mode-hook (function dm-hook))