bug#81509: 31.0.91; Calling dired on nonexistent directory changes current buffer
Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 28 Jul 2026 21:12:24 +0300 Eli Zaretskii <[email protected]> wrote: >> From: Stephen Berman <[email protected]> >> Cc: [email protected], [email protected] >> Date: Tue, 28 Jul 2026 18:40:55 +0200 >> >> On Tue, 28 Jul 2026 20:04:32 +0530 (IST) Madhu <[email protected]> wrote: >> >> > * Stephen Berman <[email protected]> <[email protected]> >> > Wrote on 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? >> > >> > Thanks, the patch works as expected, --Regards, Madhu >> >> Thanks for confirming, now pushed to emacs-31. > > Should this bug be closed now? Sure, done now. Thanks. Steve Berman