After setting Dired do-what-I-mean

(setq dired-dwim-target t)

which, quoting the man pages

If non-nil, Dired tries to guess a default target directory. This means: if there is a Dired buffer displayed in some window, use its current directory, instead of this Dired buffer’s current directory.

but you frequently want the target to be some other directory. In particular, you may want to copy (if copy is the operation at hand) to the same directory, not to the C-x 3 (and hence dwimeant) directory.

How do you target the present directory, once in a while, with dwim enabled?

  • 1
    What do you mean by "exclude" here? Do you mean ahead of time in some sense, or when you actually do the copy or whatever? (In the latter case you just tell it what target you want.) The question isn't clear to me.
    – Drew
    Commented Nov 1, 2021 at 15:49
  • @Drew yeah... "exclusion" was hardly the best word. Rephrased, but anyway phils provides exactly the solution I was seeking.
    – Calaf
    Commented Nov 3, 2021 at 2:58

1 Answer 1


I think such exclusions cannot be pre-determined, but are simply decisions you make at the time you decide to copy the file.

In such cases I just use M-n at the prompt, which gives me the original directory as the first option.

M-n runs the command next-history-element

Puts next element of the minibuffer history in the minibuffer. With argument N, it uses the Nth following element. The position in the history can go beyond the current position and invoke "future history."

Where "future history" can be alternatively phrased as "educated guesses". This works at many prompts.

In this case, dired ensures that the original directory is first in that list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.