1

In Dired, I'm able to drill down folders with the key i, but how can I unfold a folder that was once opened, that is, go to its parent folder?

3

What did you try?

C-h m tells you about the current mode for an Emacs buffer. In Dired it lists the key bindings, including ^, which takes you to the parent directory, in Dired.

C-h k ^ tells you:

^ runs the command dired-up-directory (found in dired-mode-map), which is an interactive compiled Lisp function in dired.el.

It is bound to ^, <menu-bar> <subdir> <up>.

(dired-up-directory &optional OTHER-WINDOW)

Run Dired on parent directory of current directory.

Find the parent directory either in this buffer or another buffer. Creates a buffer if necessary. If OTHER-WINDOW (the optional prefix arg), display the parent directory in another window.

If you use Dired+ then ^ is this instead:

^ runs the command diredp-up-directory (found in dired-mode-map), which is an interactive compiled Lisp function in dired+.el.

It is bound to ^, menu-bar subdir navigate up.

(diredp-up-directory &optional OTHER-WINDOW)

Run Dired on parent directory of current directory.

Find the parent directory either in this buffer or another buffer. Creates a buffer if necessary.

With a prefix arg, Dired the parent directory in another window.

On MS Windows, if you are already at the root directory, invoke diredp-w32-drives to visit a navigable list of Windows drives.


But since you mention i and drilling down in the sense of showing a subdirectory listing, maybe you are asking (also?) how to get back to the parent directory listing from a subdirectory listing. ^ also does that.

With Dired+, you can alternatively use i again, with the cursor on a file in the subdir listing or on the subdir header line (but not with the cursor on a subdir in the subdir listing - in that case that subdir is itself listed).

In other words, i toggles back and forth between parent and child directory.

In vanilla Dired (not Dired+), i does not toggle this way. You need to use ^ to go to the parent listing.


You can also show/hide a subdir listing using $. And you can remove all listings other than the main one with C-x C-v.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.