Search code examples
emacsdired

Dired Mode : View file


I am running following sequence.

  1. Open dired mode with C-x d and select a directory.
  2. View a file in that directory with 'v'.
  3. Kill that file with C-x k RET.

I see that Current buffer is one of the previously opened (P) something else rather than the one in dired mode. Even if I kill this buffer P with C-x k RET I still do not see the dired-mode buffer.

I like to go back to the dired-mode buffer. I can still get it via C-x C-b, but I would prefer that this should be automatic choice once I view the file and kill it.


Solution

  • You should just use q for View-quit (or Q for View-quit-all). That's important, because those to actually try to restore the windows configuration.

    If you can't restrain your muscle memory you can bind C-x k to View-quit

    (add-hook 'view-mode-hook (lamdba () (local-set-key (kbd "C-x k") 'View-quit))