简体   繁体   中英

Emacs file navigation

I use the emacs . command to navigate a directory tree when I am not sure exactly where a file is. My problem is: When I close a given file, I am back at the top of the directory.

Does anyone know a way to close a file and go back to the current branch in the directory tree?

That would require emacs to be able to change the current working directory of your shell, which isn't directly possible.

As a workaround, you can use the shell built into emacs (there are several variants).

Cx Cv will prompt you for a file, starting in the same directory as the file in the active buffer. After you pick a new file, it will close the old file and replace it with the new one. Does that do what you want?

I use the ido package to open files. When I have a file open and hit Cx Cf Cd (open file then Cd) it will open up dired in that file's directory. Will that solve your problem?

Simply stop closing files it's not worth the effort. If you shut down emacs at the end of the day then the files will be closed anyway. Othewise you can use midnight mode to regularly clean up unused buffers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM