From 2df705d3f133dfd3c9bada6423084990a67f878f Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 15 Apr 2010 15:54:09 -0400 Subject: [PATCH] Added a dired-mode-hook. --- mode-hooks.el | 1 + mode-hooks/dired-mode-hooks.el | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 mode-hooks/dired-mode-hooks.el diff --git a/mode-hooks.el b/mode-hooks.el index 679909e..5ce108c 100644 --- a/mode-hooks.el +++ b/mode-hooks.el @@ -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 index 0000000..80efd0b --- /dev/null +++ b/mode-hooks/dired-mode-hooks.el @@ -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 "") '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)) -- 2.44.2