Subject: Re: bug#35385: 27.0.50; Make dired-dwim-target aware of other frames

From: Juri Linkov <[email-masked]>
Date: Wed, 13 Nov 2019 23:41:16 +0200

> I think we should add that the non-nil value can be a function, and that
> in this case that function will be called with zero arguments and is
> expected to return a list of directories which will be used as defaults
> (i.e. default target and "future history") (though,
> `dired-dwim-target-defaults' might modify it a bit).
>
> The sentence "You can customize it to prefer either the next window with
> a Dired buffer, or the most recently used window with a Dired buffer."
> could get appended "or something else".

Do you think this is good enough?

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 8fab508dea..d1863510d4 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -659,7 +659,10 @@ Operating on Files
 some window, that other buffer's directory is suggested instead.
 You can customize @code{dired-dwim-target} to prefer either the next
 window with a Dired buffer, or the most recently used window with
-a Dired buffer.
+a Dired buffer, or to use any other function.  When the value is
+a function, it will be called with no arguments and is expected to
+return a list of directories which will be used as defaults
+(i.e. default target and ``future history'').
 
   Here are the file-manipulating Dired commands that operate on files.
 
diff --git a/lisp/dired.el b/lisp/dired.el
index 009018fafe..15286cc9b0 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -190,7 +190,11 @@ dired-dwim-target
 current directory.
 
 You can customize it to prefer either the next window with a Dired buffer,
-or the most recently used window with a Dired buffer.
+or the most recently used window with a Dired buffer, or to use any other
+function.  When the value is a function, it will be called with no
+arguments and is expected to return a list of directories which will
+be used as defaults (i.e. default target and \"future history\")
+(though, `dired-dwim-target-defaults' might modify it a bit).
 
 The target is used in the prompt for file copy, rename etc."
   :type '(choice