Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs dired use the same buffer

Tags:

emacs

dired

I use the following code in .emacs:

(require 'dired+)
(toggle-diredp-find-file-reuse-dir 1)

So it won't create a buffer for every dir I visit. Then I decided to add some ergonomics:

(add-hook 'dired-mode-hook
          (lambda ()
            (define-key dired-mode-map (kbd "C-<up>") 'dired-up-directory)))

So when I click Ctrl-<up> it will move to the parent directory. But it opens the parent dir in a new buffer.

How to make it open in the same buffer?

like image 871
user4035 Avatar asked Sep 26 '12 11:09

user4035


1 Answers

The solution can be found there:

(add-hook 'dired-mode-hook
 (lambda ()
  (define-key dired-mode-map (kbd "C-<up>")
    (lambda () (interactive) (find-alternate-file "..")))
  ; was dired-up-directory
 ))
like image 176
Sébastien Le Callonnec Avatar answered Sep 21 '22 17:09

Sébastien Le Callonnec