From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 16 15:35:27 2023 Received: (at submit) by debbugs.gnu.org; 16 Dec 2023 20:35:27 +0000 Received: from localhost ([127.0.0.1]:56148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEbNe-0008MG-Jn for submit@debbugs.gnu.org; Sat, 16 Dec 2023 15:35:27 -0500 Received: from lists.gnu.org ([2001:470:142::17]:47616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEbNa-0008M0-5S for submit@debbugs.gnu.org; Sat, 16 Dec 2023 15:35:24 -0500 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 1rEbNT-0000Az-Os for bug-gnu-emacs@gnu.org; Sat, 16 Dec 2023 15:35:15 -0500 Received: from greenhill.hpalace.com ([192.155.80.58]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rEbNR-0001Sd-IY for bug-gnu-emacs@gnu.org; Sat, 16 Dec 2023 15:35:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1702758910; bh=loHW2DSnP17WjvyTd+EhqdVtAYSy8QsydiwQilWp46o=; h=Date:From:To:Subject:From; b=bNz4S9nZW2/Yjz0TdL/wWjFXfWcTrBOt/8SROWuJpZHcCbENIv0P3Dd5hPiM/gFV5 fxfODnSTz0cM4vENQ3MZxwsRArhIoeVT64vBePwGYjb0z36yPIhnKFczZkBw5IVqkf dsLg+eff6TaF6ePF72iVcTJFi/2WXWttk3Es9+ot6HXAOKSogMBiLab8+sqsV5P4sg 0nk+AtL0MhYHrSe6FwgyJwcO4JWPRM7HaIIak+QZmBleSBQCiIkm7yHeA+xzjf2V0C 7p2UNUOHMiaEDQYegq52ny9Wc/IXkZuRq7b6JrpJ6veFC7GImfQuu2Vv8W1VC4TGZN 8eMf4uP0RLtiw== Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id B229D430 for ; Sat, 16 Dec 2023 20:35:10 +0000 (UTC) MIME-Version: 1.0 Date: Sat, 16 Dec 2023 12:35:10 -0800 From: Jared Finder To: Bug-gnu Emacs Subject: Dired navigation via directory line does not respect dired-kill-when-opening-new-dired-buffer Message-ID: <08113bf5fecdaaffc112749f230a5c0b@finder.org> X-Sender: jared@finder.org Content-Type: multipart/mixed; boundary="=_f24fb6a93b56ace6d78abbc7d7938497" Received-SPF: pass client-ip=192.155.80.58; envelope-from=jared@finder.org; helo=greenhill.hpalace.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=_f24fb6a93b56ace6d78abbc7d7938497 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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. Steps to reproduce: emacs -Q M-x load-library RET dired RET M-x set-variable RET dired-kill-when-opening-new-dired-buffer RET t RET C-x d ~/ RET Click something in the directory line like "home" in "/home/jared" for myself. C-x C-b See that there are two directory buffers instead of just one. In GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) of 2023-09-11, modified by Debian built on melete System Description: Debian GNU/Linux 12 (bookworm) Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/libexec --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.1/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-native-compilation --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/libexec --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd --with-pop=yes --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.1/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --without-gconf --with-mailutils --with-native-compilation --with-pgtk 'CFLAGS=-g -O2 -ffile-prefix-map=/build/emacs-N816CI/emacs-29.1+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Dired by name Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils mule-util display-line-numbers dired-aux cus-edit pp cus-start cus-load wid-edit help-fns radix-tree dired dired-loaddefs thingatpt cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cl-lib find-func rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo gtk pgtk lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 105919 13638) (symbols 48 9060 0) (strings 32 24805 2351) (string-bytes 1 725024) (vectors 16 17316) (vector-slots 8 354985 19128) (floats 8 37 33) (intervals 56 711 0) (buffers 984 14)) --=_f24fb6a93b56ace6d78abbc7d7938497 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-Clicks-on-directory-line-kill-prev-buffer-if-option-.patch Content-Disposition: attachment; filename=0001-Clicks-on-directory-line-kill-prev-buffer-if-option-.patch; size=1225 RnJvbSA0NWQyNjAxYTgyMTllZjM5MmJiMDE5MTY5M2I1Nzg1MTYwZDIyM2ZjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKYXJlZCBGaW5kZXIgPGphcmVkQGZpbmRlci5vcmc+CkRhdGU6 IFNhdCwgMTYgRGVjIDIwMjMgMTI6MTA6MDMgLTA4MDAKU3ViamVjdDogW1BBVENIXSBDbGlja3Mg b24gZGlyZWN0b3J5IGxpbmUga2lsbCBwcmV2IGJ1ZmZlciBpZiBvcHRpb24gaXMgc2V0CgpUaGUg b3B0aW9uIGRpcmVkLWtpbGwtd2hlbi1vcGVuaW5nLW5ldy1kaXJlZC1idWZmZXIgc2hvdWxkIGJl IGNoZWNrZWQKaW4gdGhpcyBjb2RlIHBhdGggYXMgd2VsbC4KCiogbGlzcC9kaXJlZC5lbCAoZGly ZWQtLW1ha2UtZGlyZWN0b3J5LWNsaWNrYWJsZSk6IENhbGwKZGlyZWQtLWZpbmQtcG9zc2libHkt YWx0ZXJuYXRpdmUtZmlsZSBpbnN0ZWFkIG9mIGRpcmVkIGluIGNsaWNrCmNhbGxiYWNrLgotLS0K IGxpc3AvZGlyZWQuZWwgfCAyICstCiAxIGZpbGUgY2hhbmdlZCwgMSBpbnNlcnRpb24oKyksIDEg ZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9saXNwL2RpcmVkLmVsIGIvbGlzcC9kaXJlZC5lbApp bmRleCAzM2UzOGVkMmMxYy4uMDNmNjczYzVlMjIgMTAwNjQ0Ci0tLSBhL2xpc3AvZGlyZWQuZWwK KysrIGIvbGlzcC9kaXJlZC5lbApAQCAtMjAxMiw3ICsyMDEyLDcgQEAgZGlyZWQtLW1ha2UtZGly ZWN0b3J5LWNsaWNrYWJsZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo aW50ZXJhY3RpdmUpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpZiAo YXNzb2MgY3VycmVudC1kaXIgZGlyZWQtc3ViZGlyLWFsaXN0KQogICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKGRpcmVkLWdvdG8tc3ViZGlyIGN1cnJlbnQtZGlyKQot ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChkaXJlZCBjdXJyZW50LWRp cikpKSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGRpcmVkLS1m aW5kLXBvc3NpYmx5LWFsdGVybmF0aXZlLWZpbGUgY3VycmVudC1kaXIpKSkpKQogICAgICAgICAg ICAgICAgICAgICAgICAgKGRlZmluZS1rZXltYXAKICAgICAgICAgICAgICAgICAgICAgICAgICAg Ijxtb3VzZS0yPiIgY2xpY2sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIjxmb2xsb3ctbGlu az4iICdtb3VzZS1mYWNlCi0tIAoyLjM5LjIKCg== --=_f24fb6a93b56ace6d78abbc7d7938497-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 16 17:06:16 2023 Received: (at control) by debbugs.gnu.org; 16 Dec 2023 22:06:16 +0000 Received: from localhost ([127.0.0.1]:56228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEcnX-0001Zz-NM for submit@debbugs.gnu.org; Sat, 16 Dec 2023 17:06:15 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:59477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEcnS-0001Ze-PT for control@debbugs.gnu.org; Sat, 16 Dec 2023 17:06:14 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3332efd75c9so1512348f8f.2 for ; Sat, 16 Dec 2023 14:06:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702764363; x=1703369163; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=04KV/aBcmsYKEsVHWXacNjzBD4xPnGb4FD7F6sV6YNw=; b=MzebGNni8Ur15mSrkOWd1TO6JHmyFPfKaBhHZfGp8jOYWHkPQox1+SzKTnsqnc5Opz lWG+qtDjWxH29/I3l/XPOi0Upcp3iAphyfvIGkmm/rWoT90ChtTyC60Oe7DO9/UIZI75 P7SKd2VLtSY8aw5M5b8bcaK793ayaOLUXtJin9jDdXEcShqEfhsNq97w5T90BBtffiMn p+nnw2IYsoP10tP5bFqdq3g6Qni+6Ys/mw3DQFyFomM1OIPoMIcyOU+IcODcLATU34Uy Ma4Zp6hBYdiO5i+nIh0Q3/yhSq3Vy50lTKdvGM5C1WiOF/KYEsvIT4tHucz2YLrgju3F iHCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702764363; x=1703369163; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=04KV/aBcmsYKEsVHWXacNjzBD4xPnGb4FD7F6sV6YNw=; b=s+qEoli2pcKSkj+iZe3AqXht0e1nr5rDA7RXpW74g03ed6ZEx+bbBQAhUdTilnJQOa y/wmTPq2vKjvhf+R9BVFIue+YsGFPxCbSi9ob42nGRbKVyroVAOvgOWz1BwbouoltEc2 EacfwJ4EZ703XjRQMZjk+2uQHbhZYNsX4hItI3ozlfLxMvCfxDt8MekS5dBiUWJcRmbi JngbAQIiH69aTUP1KfLqY301MgUIKLfTvkwl4oIFjWE+7hnDLyLtNuwUoson09/R8s2c B0J2st/y/IQJZznE8a3MEImMuze6K5fwobllmQqZkvlhHvwQsjHjEpW/2fGSEBJtxRWT eJ6A== X-Gm-Message-State: AOJu0YyjRRfrGre1SXPKQcXvcjrnj98l8vlXbxmDc42dgNYlCJGBpY86 71uIa/IRPN+9ZypzryikthVo/G8ZlBPFny6T9+nQIVI9NKVbIA== X-Google-Smtp-Source: AGHT+IH9X/O4hO5a/tTPEzi+0bGvx2v3sjO3S6Yn+XyaU7Hc6avolAMYtPaKtKoPJX7KSfZs5JV6j0umxnAN2G3Stm4= X-Received: by 2002:adf:e911:0:b0:333:3117:c437 with SMTP id f17-20020adfe911000000b003333117c437mr3632030wrm.200.1702764363615; Sat, 16 Dec 2023 14:06:03 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 16 Dec 2023 14:06:03 -0800 From: Stefan Kangas MIME-Version: 1.0 Date: Sat, 16 Dec 2023 14:06:03 -0800 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 67856 + patch thanks Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:435 listed in] [list.dnswl.org] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 2.0 BLANK_SUBJECT Subject is present but empty -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 67856 + patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 08:18:50 2023 Received: (at 67856) by debbugs.gnu.org; 21 Dec 2023 13:18:50 +0000 Received: from localhost ([127.0.0.1]:42627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGIws-0000FF-E5 for submit@debbugs.gnu.org; Thu, 21 Dec 2023 08:18:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGIwq-0000F3-SB for 67856@debbugs.gnu.org; Thu, 21 Dec 2023 08:18:49 -0500 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 1rGIwf-0004Mt-RP; Thu, 21 Dec 2023 08:18:39 -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=4uh8wo3GAerYyMO6V1kwmM96oy+ooowLdkWlXya6iNk=; b=Y4ZiXmQNeizq tJkmS/biWm+mss9D70mWFeeMEbqMiwg6O6RLKvbDQ1+niF8t3/jY7I2iTXRTxkEupP9l+Q5l6eFxC DtpyO8vfDCjOl63ru/VRFMJijMLTDgkgTivZf8F6+NoJVEPj8cAX8MmTZx0R4tlFpXlIfH31wa8+D gnGSqEJm4x/oKV7xaCSMc1TRN++GNvwxlqk42DgaenYkxktYdBt4IGjRMcuu/bvO9GGZLENyn2EDC NZJ2KbyriNY9VMCAvFojzJEW1/atyKmHIVj9sAJHQJ5MU9B0hOdsZ5hTDtS6MN3CRW7nVTxQvOd83 JqXJD3H+N1wz9zCZNoQQbg==; Date: Thu, 21 Dec 2023 15:18:20 +0200 Message-Id: <83sf3vg0df.fsf@gnu.org> From: Eli Zaretskii To: Jared Finder In-Reply-To: <08113bf5fecdaaffc112749f230a5c0b@finder.org> (bug-gnu-emacs@gnu.org) Subject: Re: bug#67856: Dired navigation via directory line does not respect dired-kill-when-opening-new-dired-buffer References: <08113bf5fecdaaffc112749f230a5c0b@finder.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67856 Cc: 67856@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 24 15:11:59 2023 Received: (at 67856) by debbugs.gnu.org; 24 Dec 2023 20:11:59 +0000 Received: from localhost ([127.0.0.1]:53597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHUpL-00079P-Ab for submit@debbugs.gnu.org; Sun, 24 Dec 2023 15:11:59 -0500 Received: from greenhill.hpalace.com ([192.155.80.58]:45540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHUpI-00079H-Rd for 67856@debbugs.gnu.org; Sun, 24 Dec 2023 15:11:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=finder.org; s=2018; t=1703448709; bh=GPi31s60lefv96tW4WqdAhq1eOBCEVw67ZqhR8zHxVM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BxtsrJwn2YFCGpMq2Xiq6mJWI9ClmDRz+h92SgnUI6e6w416LVRyKsFN9xwBf3FmA gbA4jl0K+QAWkTsM49ofGzXay2hG2PO4ebg5mYW1BNPKVLt7oVJVirCNbPew7skZv1 /KVCYZM/gLOjvMYPJhKPgULJFZNTO5SngYLSOc8jWPhEuxwdP4tFhyFafY4q5/MZ1t vIyiQ60B6i2DpZN9GNZp6OjkU28nVtonY5UJpt8LDD2ZRAKS5nJS4Y7/1sSPRiieNz Hxtm4ac3WWUTjcQIHWImjD7mXS8a9/cpwJBqiN7gJe6SxLkWDXVrrdA7Vf8cVC+GP1 392lebWcQKIyA== Received: from mail.finder.org (unknown [192.155.80.58]) by greenhill.hpalace.com (Postfix) with ESMTPSA id C0221530; Sun, 24 Dec 2023 20:11:49 +0000 (UTC) MIME-Version: 1.0 Date: Sun, 24 Dec 2023 12:11:49 -0800 From: Jared Finder To: Eli Zaretskii Subject: Re: bug#67856: Dired navigation via directory line does not respect dired-kill-when-opening-new-dired-buffer In-Reply-To: <83sf3vg0df.fsf@gnu.org> References: <08113bf5fecdaaffc112749f230a5c0b@finder.org> <83sf3vg0df.fsf@gnu.org> Message-ID: <9b86ffe265056857ab5ada6870451f84@finder.org> X-Sender: jared@finder.org Content-Type: multipart/mixed; boundary="=_988bb1484bdf884238e96450fbf6c8d9" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67856 Cc: 67856@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=_988bb1484bdf884238e96450fbf6c8d9 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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. -- MJF --=_988bb1484bdf884238e96450fbf6c8d9 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-Clicks-on-directory-line-kill-prev-buffer-if-option-.patch Content-Disposition: attachment; filename=0001-Clicks-on-directory-line-kill-prev-buffer-if-option-.patch; size=2131 RnJvbSAzMGFkMmI4YWNlZjM2YTNhYjE0ZjA0NWJjYTk0ZDc5ODdlY2Q5NmU4IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKYXJlZCBGaW5kZXIgPGphcmVkQGZpbmRlci5vcmc+CkRhdGU6 IFNhdCwgMTYgRGVjIDIwMjMgMTI6MTA6MDMgLTA4MDAKU3ViamVjdDogW1BBVENIXSBDbGlja3Mg b24gZGlyZWN0b3J5IGxpbmUga2lsbCBwcmV2IGJ1ZmZlciBpZiBvcHRpb24gaXMgc2V0CgpUaGUg b3B0aW9uIGRpcmVkLWtpbGwtd2hlbi1vcGVuaW5nLW5ldy1kaXJlZC1idWZmZXIgc2hvdWxkIGJl IGNoZWNrZWQKaW4gdGhpcyBjb2RlIHBhdGggYXMgd2VsbC4KCiogbGlzcC9kaXJlZC5lbCAoZGly ZWQtLW1ha2UtZGlyZWN0b3J5LWNsaWNrYWJsZSk6IENhbGwKZGlyZWQtLWZpbmQtcG9zc2libHkt YWx0ZXJuYXRpdmUtZmlsZSBpbnN0ZWFkIG9mIGRpcmVkIGluIGNsaWNrCmNhbGxiYWNrLgotLS0K IGxpc3AvZGlyZWQuZWwgfCAxNSArKysrKysrKysrKystLS0KIDEgZmlsZSBjaGFuZ2VkLCAxMiBp bnNlcnRpb25zKCspLCAzIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3AvZGlyZWQuZWwg Yi9saXNwL2RpcmVkLmVsCmluZGV4IDMzZTM4ZWQyYzFjLi5mYzkxYjU4ZWNhZCAxMDA2NDQKLS0t IGEvbGlzcC9kaXJlZC5lbAorKysgYi9saXNwL2RpcmVkLmVsCkBAIC0yMDEwLDkgKzIwMTAsMTgg QEAgZGlyZWQtLW1ha2UtZGlyZWN0b3J5LWNsaWNrYWJsZQogICAgICAgICAgICAgICBrZXltYXAg LChsZXQqICgoY3VycmVudC1kaXIgZGlyKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo Y2xpY2sgKGxhbWJkYSAoKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo aW50ZXJhY3RpdmUpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpZiAo YXNzb2MgY3VycmVudC1kaXIgZGlyZWQtc3ViZGlyLWFsaXN0KQotICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKGRpcmVkLWdvdG8tc3ViZGlyIGN1cnJlbnQtZGlyKQot ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChkaXJlZCBjdXJyZW50LWRp cikpKSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChjb25kCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKGFzc29jIGN1cnJlbnQtZGlyIGRp cmVkLXN1YmRpci1hbGlzdCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAoZGlyZWQtZ290by1zdWJkaXIgY3VycmVudC1kaXIpKQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgOzsgSWYgdGhlcmUgaXMgYSB3aWxkY2FyZCBjaGFyYWN0ZXIgaW4g dGhlIGRpcmVjdG9yeSwgZG9uJ3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIDs7IHVzZSB0aGUgYWx0ZXJuYXRlIGZpbGUgbWFjaGluZXJ5IHdoaWNoIHRyaWVzIHRvIGtl ZXAgb25seQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOzsgb25lIGRp cmVkIGJ1ZmZlciBvcGVuIGF0IG9uY2UuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICA7OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOzsgRklY TUU6IElzIHRoaXMgY29kZSBwYXRoIHJlYWNoYWJsZT8KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICgoaW5zZXJ0LWRpcmVjdG9yeS13aWxkY2FyZC1pbi1kaXItcCBjdXJy ZW50LWRpcikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZGlyZWQg Y3VycmVudC1kaXIpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHQK KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZGlyZWQtLWZpbmQtcG9z c2libHktYWx0ZXJuYXRpdmUtZmlsZSBjdXJyZW50LWRpcikpKSkpKQogICAgICAgICAgICAgICAg ICAgICAgICAgKGRlZmluZS1rZXltYXAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIjxtb3Vz ZS0yPiIgY2xpY2sKICAgICAgICAgICAgICAgICAgICAgICAgICAgIjxmb2xsb3ctbGluaz4iICdt b3VzZS1mYWNlCi0tIAoyLjM5LjIKCg== --=_988bb1484bdf884238e96450fbf6c8d9-- From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 25 08:08:49 2023 Received: (at 67856-done) by debbugs.gnu.org; 25 Dec 2023 13:08:49 +0000 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 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 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==; Date: Mon, 25 Dec 2023 15:08:27 +0200 Message-Id: <83zfxya0qc.fsf@gnu.org> From: Eli Zaretskii To: Jared Finder In-Reply-To: <9b86ffe265056857ab5ada6870451f84@finder.org> (message from Jared Finder on Sun, 24 Dec 2023 12:11:49 -0800) Subject: Re: bug#67856: Dired navigation via directory line does not respect dired-kill-when-opening-new-dired-buffer References: <08113bf5fecdaaffc112749f230a5c0b@finder.org> <83sf3vg0df.fsf@gnu.org> <9b86ffe265056857ab5ada6870451f84@finder.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67856-done Cc: 67856-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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. From unknown Mon Jun 23 16:49:25 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 23 Jan 2024 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator