From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felix Newsgroups: gmane.emacs.devel Subject: [PATCH] change dired--find-possibly-alternative-file behaviour. Date: Sat, 25 Feb 2023 20:43:57 +0100 Message-ID: <87mt51o5bu.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23035"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.3; emacs 30.0.50 To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Feb 25 21:35:34 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pW1GY-0005pV-8E for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Feb 2023 21:35:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pW1Fj-0007kX-SP; Sat, 25 Feb 2023 15:34:43 -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 1pW1Fi-0007k8-Eb for emacs-devel@gnu.org; Sat, 25 Feb 2023 15:34:42 -0500 Original-Received: from mout.web.de ([212.227.15.4]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pW1Fg-0003Iy-JS for emacs-devel@gnu.org; Sat, 25 Feb 2023 15:34:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1677357277; i=felix.dick@web.de; bh=yTWfimElx9lwLep039YeGowA/n7nN0fgVp5kN37RHuU=; h=X-UI-Sender-Class:From:To:Subject:Date; b=YCtALxlIWMahwK/W6fEUDVPhUGSF+bs9vmUi7Ms49pB+aatgn6ulCwaRJfuBaVclC +L/MGQCTXCe5KEFn9WQpSI4q9REJxiv4jEZ/x1u990nmT11SOf0oogf3EWqf31rgZa il2aB0Hgx60Tj0vhhy8hznPXXOPGs2eHbUnZegPV99e8RduFH08lPBmuiOkko0xZ5i oJS5495bRi1jNW7WtyMDOTs/U4rFZuKKApEiQ1Lf8ZgOhl+na9ceF3ESO/Mx+5miiW J9dwVesKhryoK9U8Gv6Oi7BeqYP8jmPY5i3Mmc1lstMLn9eTt02wR8L4cBqprkLtv9 qpklgrayYr35A== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from felix-lifebooka531.web.de ([95.91.210.224]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N9cHJ-1oTQ6q37zh-015GSO for ; Sat, 25 Feb 2023 21:34:37 +0100 X-Provags-ID: V03:K1:ZsntCOV0oiOJXJieh6geWcn7a2T1yvd+/vkijTgjkKNQMsh1+cV o3LeAD6PPefrsaeeo+rEl5AxRRnGo2IZMZ8rLb6txJXk0zQhCR5FBwh9WSKICaF289HqETO ZUBHBLhhN9webMChPKdF9akSbQtwWfliNaEalhnJG3f4fuvLpKtD34VHHLzgTipdlDJlzjL +ZBLJ+wKQh3RGHBwKOtYg== UI-OutboundReport: notjunk:1;M01:P0:sgRYfQ+4h9U=;8XL5PIOheBYuRX3dEVVrkv6duMf I+p8DCB6iUgURU7JzJKzL6ImFU++Swut03hM6FlZv0TRMMg/BJCV8RdVHl0c9qaZJz7znjPj5 7582eViBIFBeKg08BympFCVFeerSCLISOJvLCuduA/tkoj+s/uz8rQGsTPEzuUsmzHtW+TeOC F6dn+sd/mu/mP9llh+i6h/OES76maMtkeotFlqxFBFD1+HMawrx7MFqy9l1WvkMCai9oOxDSw vUTRRiPoKEFdwqedX0VEqVKWI8F4Frzos1yaWJRixr6ukCttkfNeJ5coILq95cWIL7OzrMFnE VnZHjr1KNuD2+XX23R+C2d3aPz04jWG7aqLigHCM/3alVmd5POeckn6Nc35BKFjU5dHAqwxoi 6Xowo0Upj/6y69ks0Lg49Y2UPXPOUW3Z9YhxZmSYAAz0vLM8mZeCvHxX7/0K54hcrlO70eKW7 AKo6C52CrsUPK8NAJPMT7rQm0EkClVa3rlVzuwAaRKoiHiNPMvK+X2Wn7z/I6sFNHvZttVXFl aJ/Lied7nm5bQiEdi8FnxJjGSlHM0WZCrM/tmehxqk9nkTLvhEolToN4kr+Kl9uRBcMunnvOY VNOxTZZ5n7sbhaAn/SSWmyayBKNU9eKbVT7LXUzNIVPE72zS2Q8eex7YyDmPeTQLUi+mv/6Ju P/DmpoJrAyG3iXVcNrxb48j+iQdNFzAloH7XeZiIwGUQ+AWytbpeA+g9CldXOn0L3aNgcVQgE oi2gL9lXpbSP8l69Hi14dLlITzW8di/72xDcWVMIMtCshyVjMKS37X5ISEOdtMULkX9bx6JC Received-SPF: pass client-ip=212.227.15.4; envelope-from=felix.dick@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303804 Archived-At: --=-=-= Content-Type: text/plain I find dired--find-possibly-alternative-file a bit confusing if dired-kill-when-opening-new-dired-buffer is set to t. It's fine if the active window is the only window that shows that dired buffer, but if there are multiple windows showing dired buffers, it's likely that the user wanted to have those windows showing dired buffers. If those buffers happen to show the same directory, opening another directory with dired-find-file will kill the buffer, and change the shown buffer in both windows. Before dired-kill-when-opening-new-dired-buffer, to copy/move a file to another directory, i could open a dired buffer, split the window, in one of the windows (both showing the same dired buffer) navigate to another directory and copy the file (with the dired-dwim-target). In my personal configuration, i changed dired--find-possibly-alternative-file to not kill the buffer if it's shown in another window. I'm not shure if this would fit every workflow, but for me it feels more logical. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=dired.patch diff --git a/lisp/dired.el b/lisp/dired.el index 76499d0f520..620508bef4f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2728,7 +2728,8 @@ dired-find-file (defun dired--find-possibly-alternative-file (file) "Find FILE, but respect `dired-kill-when-opening-new-dired-buffer'." (if (and dired-kill-when-opening-new-dired-buffer - (file-directory-p file)) + (file-directory-p file) + (= (length (get-buffer-window-list)) 1)) (progn (set-buffer-modified-p nil) (dired--find-file #'find-alternate-file file)) --=-=-=--