I exclusively use frames and I've long wondered if there's a way to get
dired-dwim-target to suggest a dired buffer from another frame instead of just another window.
dired-dwim-target-directory so that in the call to
get-window-with-predicate it passes a non-nil value (e.g.,
visible) for optional arg
(defun dired-dwim-target-directory () ;; Try to guess which target directory the user may want. ;; If there is a dired buffer displayed in one of the next windows, ;; use its current subdir, else use current subdir of this dired buffer. (let ((this-dir (and (eq major-mode 'dired-mode) (dired-current-directory)))) ;; non-dired buffer may want to profit from this function, e.g. vm-uudecode (if dired-dwim-target (let* ((other-win (get-window-with-predicate (lambda (window) (with-current-buffer (window-buffer window) (eq major-mode 'dired-mode))) nil 'visible)) ; <======================== (other-dir (and other-win (with-current-buffer (window-buffer other-win) (and (eq major-mode 'dired-mode) (dired-current-directory)))))) (or other-dir this-dir)) this-dir)))
And please consider filing an enhancement request (
M-x report-emacs-bug), suggesting, for example, that this argument be taken from the value of
pop-up-frames (or from a new user option or from something else). The idea is to let users decide whether the Dired buffer is to be in another window of the same frame or in any (visible) frame.
I've added this to Dired+ (
dired+.el), so it should work out-of-the-box. It respects a new Boolean option,
diredp-dwim-any-frame-flag: non-nil means look also in other frames. The default value is the value of
pop-up-frames (so if that option is non-nil then so is