dired-x: Multiple Dired Directories
8 Multiple Dired Directories and Non-Dired Commands
***************************************************
An Emacs buffer can have but one working directory, stored in the
buffer-local variable ‘default-directory’. A Dired buffer may have
several subdirectories inserted, but it still has only one working
directory: that of the top-level Dired directory in that buffer. For
some commands it is appropriate that they use the current Dired
directory instead of ‘default-directory’, e.g., ‘find-file’ and
‘compile’.
The command ‘dired-smart-shell-command’, bound to ‘M-!’ in Dired
buffers, is like ‘shell-command’, but it runs with ‘default-directory’
bound to the current Dired directory.