bug#81509: 31.0.91; Calling dired on nonexistent directory changes current buffer
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
> From: Stephen Berman <[email protected]> > Cc: Eli Zaretskii <[email protected]>, Madhu <[email protected]> > Date: Tue, 28 Jul 2026 15:55:29 +0200 > > This behavior is a by-product of 3b7d9e37ce0c. (BTW, the nonexistent > directory doesn't have to be represented by a wildcard in the sense of a > shell glob (e.g. *nonexist*), i.e. C-x d /tmp/a/nonexist also shows the > same behavior. But /tmp/a/nonexist is a wildcard in the sense of > insert-directory and maybe that's what the OP meant.) Before that > change, when attempting to visit in Dired a nonexistent directory, > insert-directory signalled an error, which short-circuited the Dired > command, so that the current buffer when the Dired command was invoked > remained current. Since 3b7d9e37ce0c, ls errors, such as trying to > display a nonexistent directory, are now shown in a special buffer after > completing the Dired command, as you observed. But the Dired commands > use `pop-to-buffer-same-window' and > `switch-to-buffer-other-{window,frame,tab}' and calling these with a > nonexistent directory - i.e. with nil - as argument makes another buffer > current. I agree this is surprising behavior. The attached patch > prevents this, i.e., the buffer that was current when the Dired command > was invoked remains current when the directory to be visited is > nonexistent. Madhu, can you confirm? > > Eli, if this patch DTRT for Madhu can it be installed in emacs-31, since > the undesirable behavior was due to changes there? Yes, please.