From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67856: Dired navigation via directory line does not respect dired-kill-when-opening-new-dired-buffer Date: Mon, 25 Dec 2023 15:08:27 +0200 Message-ID: <83zfxya0qc.fsf@gnu.org> References: <08113bf5fecdaaffc112749f230a5c0b@finder.org> <83sf3vg0df.fsf@gnu.org> <9b86ffe265056857ab5ada6870451f84@finder.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="905"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67856-done@debbugs.gnu.org To: Jared Finder Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 25 14:09:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rHkhw-000AaF-SW for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 25 Dec 2023 14:09:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHkhg-0004dD-D7; Mon, 25 Dec 2023 08:09:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHkhV-0004cP-V8 for bug-gnu-emacs@gnu.org; Mon, 25 Dec 2023 08:08:58 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rHkhT-0008SA-Md for bug-gnu-emacs@gnu.org; Mon, 25 Dec 2023 08:08:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rHkhZ-0001MK-V4 for bug-gnu-emacs@gnu.org; Mon, 25 Dec 2023 08:09:01 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Dec 2023 13:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 67856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 67856@debbugs.gnu.org, eliz@gnu.org, jared@finder.org Original-Received: via spool by 67856-done@debbugs.gnu.org id=D67856.17035097295191 (code D ref 67856); Mon, 25 Dec 2023 13:09:01 +0000 Original-Received: (at 67856-done) by debbugs.gnu.org; 25 Dec 2023 13:08:49 +0000 Original-Received: from localhost ([127.0.0.1]:54134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHkhN-0001Lf-1B for submit@debbugs.gnu.org; Mon, 25 Dec 2023 08:08:49 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHkhH-0001LP-QB for 67856-done@debbugs.gnu.org; Mon, 25 Dec 2023 08:08:47 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rHkh5-0008L7-Af; Mon, 25 Dec 2023 08:08:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=liOSaTQXbhLWfSREkHKQ5zen593DxUAMK/rMl2r+Y5g=; b=Vhv+tIQ/kgcB TaX1t72/+YL6xjzaD47Ttl2U6wO7sPe+3mWkQ1TmsvTxaHRnKlO5sESk8bWymxKAmj/V2wIHN0DUF B58oDlxfadMvMLVdnM8ZMb9Ex0AGh91jRxYLE+qUTgqZDGQvHhgl9NZRY9o8cod2QgnnH/0xkc/ZO KExMf4o0PJj/8Dp06+IQXS3NdlC6GzljlyJG6emmD9kuuQXN/wR6dm1aGbeXV/x4AilYjDZ9fdB4M VBJQt4g2py0RuDe+QvrRtrA3RbmUH7hpZ1PlMUr4hvXgZWPxYs/PrpidyDY4PA1TNobCH4sGaoIU3 i2E+sJHKz/Q0EJpa10RyNQ==; In-Reply-To: <9b86ffe265056857ab5ada6870451f84@finder.org> (message from Jared Finder on Sun, 24 Dec 2023 12:11:49 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276849 Archived-At: > Date: Sun, 24 Dec 2023 12:11:49 -0800 > From: Jared Finder > Cc: 67856@debbugs.gnu.org > > On 2023-12-21 05:18, Eli Zaretskii wrote: > >> Date: Sat, 16 Dec 2023 12:35:10 -0800 > >> From: Jared Finder via "Bug reports for GNU Emacs, > >> the Swiss army knife of text editors" > >> > >> The option dired-kill-when-opening-new-dired-buffer is not respected > >> when clicking on parent directories in the directory line at the top > >> of dired buffers. This can be fixed by calling > >> dired--find-possibly-alternate-file instead of dired in the > >> callback, as my attached patch does. > >> > >> I believe changing to dired--find-possibly-alternate-file is safe > >> because from playing around with dired, the directory being clicked > >> on must be a directory and can not contain wildcards at this point. > >> Therefore, at this point it is known that the directory is just a > >> plain directory (no wildcards) and so going through find-file > >> machinery will have the intended result. > > > > If we want to install this on the emacs-29 release branch, I'd prefer > > a safer variant, which actually verified that we don't call > > dired--find-possibly-alternate-file with a wildcard. That's because > > we have quite a few features that place buffers in Dired mode, and we > > could easily miss one that does have wildcards there. > > > > So would you mind modifying the patch a little so that it checks > > whether current-dir includes wildcards, and if so, calls 'dired' > > instead of dired--find-possibly-alternate-file? > > Done, new patch attached. Luckily, there already is a function that > does exactly the right check. > > Feel free to alter the comment explaining why this third code path > exists. I wasn't sure the right style to indicate this type of > defensive code path that I am not certain is needed. Thanks, installed on the emacs-29 branch with some minor reformatting, and closing the bug.