From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#54606: 27.1; next/previous image command in image-mode triggers tramp connections for all remote dired buffers Date: Thu, 31 Mar 2022 11:47:41 +0200 Message-ID: <875ynuh2rm.fsf@gmx.de> References: <3947f11808243544dcdd4e4d2fde4922@webmail.orcon.net.nz> 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="5908"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 54606@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 31 11:48:14 2022 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 1nZrPa-0001Ii-MU for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 11:48:14 +0200 Original-Received: from localhost ([::1]:51408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZrPZ-0005H2-5e for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 31 Mar 2022 05:48:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZrPO-0005Em-OB for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 05:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44032) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZrPO-0008Kg-EU for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 05:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZrPN-00082Q-US for bug-gnu-emacs@gnu.org; Thu, 31 Mar 2022 05:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Mar 2022 09:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54606 X-GNU-PR-Package: emacs Original-Received: via spool by 54606-submit@debbugs.gnu.org id=B54606.164872008030887 (code B ref 54606); Thu, 31 Mar 2022 09:48:01 +0000 Original-Received: (at 54606) by debbugs.gnu.org; 31 Mar 2022 09:48:00 +0000 Original-Received: from localhost ([127.0.0.1]:37929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZrPM-000824-5o for submit@debbugs.gnu.org; Thu, 31 Mar 2022 05:48:00 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:51535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZrPJ-00081E-EQ for 54606@debbugs.gnu.org; Thu, 31 Mar 2022 05:47:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648720064; bh=ugY4N2iPW/vfmf2wCr6WvjCCdVhe65Ky44JEVJeonIY=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=RkzqKIHEDr7iOx9PL4Up1aUXl7PHY5r36E/RbvFWwQ4Eqd2M80O15JcyJZz0N9YXY UZU3VcaAfnyvSLqXt+BDP1A7wdg55Xq1BH3WHqPAXyNtyKFxAwwrtgdLwrm16UB2zx Bixp30DoHtrDJ1rgAbeqsG/qorffOyX2yZ2ftR2k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.151.59]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N5mKJ-1o791H07vH-017FoI; Thu, 31 Mar 2022 11:47:44 +0200 In-Reply-To: <3947f11808243544dcdd4e4d2fde4922@webmail.orcon.net.nz> (Phil Sainty's message of "Mon, 28 Mar 2022 23:13:14 +1300") X-Provags-ID: V03:K1:itZj/titvqcvWmqtK124jkLEiK9FIBSon3+cc7MkcOoN5iyvs4i D/2NoKN6Z+g3gNPFQs7qD/uCBdWBn78so74G9wT01Y2xUOGR+1HteNxTLOu4O0MjcrU2bbH SKIlkokmeB9yC/3NOKRmg6onTGoEiVsqa8h6iUwfDkM8FTMXZ1hp4F5Msvk1dIR0b+MjkIi jKEHBmBkqgx0m8ZoB+6FQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:4IcPTSf2iPM=:kI9US4Py+7ww7PmoFtnfwk /zHeFK8/ISILoG6VHF9Ivv/T92Bd2+9RqC8fLMCrC1FBgyHhEoSr+IvamC8i+1L+8Fg998JD7 m/nP70wVDO1tmixck5JXEIL+3mYOKo4wI/dkxMOStWfN38R5v7K77iStiRuSMAFbc4MLMj3xT XNxXTB3YYeo6f2KFVKGP1JHCbAYAXlfl3uUqc6XwivzgMLvqF9ADjUdgO2X3HlCiorZiYCCzw V+0YSv81YStgtD/lFeZzgRMhWhQu0QGIirxRyXG1JsthFJJ9AUwJjdn08yyl9G08jYDLvAE39 i5uByOvfH2O+lBaechQ8d6PDfwawB9spdyY/PcuavsQ66duHCsS/NbF5GlOTLcb7XODa7IaTC d16FDfxB0YuFHzULEA1agwTB09HAzJUm5y+1K6jL57cAJt5Muw3xPqLZRtLMb8OPlwqaueeT6 ZzekeZZmCX+MIDAVa/2tlfF+mhMDlwe0Yzf1Sx+Wob0KFItLFVcXslDi8uZvb6epfODm1CNpa J8vdWF+TbQG7MYj0Mbn3iaAwhDFKOb69xjkWStJcGG9iuOLWMFcFq+pa02HuHaBhRIRIw1d5J KNkueSap09qbK6NlGD6AwvVo0PmA8+ZxbvLqg20oICkxIxSldQg/6LrH8B505UckM2Tsa1eAF QMz+68vdbetA3uDkegTpMuOMG8xUaPUAOqryUNjNxaagmIb3XlqI6Py6ASCan0ylO5haLeAYA 4oInmZGXnaH/iz4khpjCSRqlp1nTwISwaH4+0tVUHEr4pBpxWdCn8YYiXuqeH+XMmaqQzxiC 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" Xref: news.gmane.io gmane.emacs.bugs:229144 Archived-At: --=-=-= Content-Type: text/plain Phil Sainty writes: Hi Phil, > In 27.1 this code is in `image-next-file'. In master it's now > `image-mode--directory-buffers', but the relevant code looks > the same: > > ;; Find a dired buffer. > (dolist (buffer (buffer-list)) > (with-current-buffer buffer > (when (and (derived-mode-p 'dired-mode) > (equal (file-truename dir) > (file-truename default-directory))) > > That call to (file-truename default-directory) for each dired > buffer can cause tramp to spin up for closed connections for > entirely irrelevant dired buffers. I've reproduced the problem. As said already (?), it is similar to bug#54542. The solution there was to wrap the code in question by let-binding non-essential to t, and to enhance Tramp to behave accordingly. The Tramp change is already in the master branch, and also in the just released Tramp 2.5.2.3 on GNU ELPA. So I've applied the following change in master: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/lisp/image-mode.el b/lisp/image-mode.el index d7dfb4336b..69af538aa7 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -1196,8 +1196,9 @@ image-mode--directory-buffers "Return an alist of type/buffer for all \"parent\" buffers to image FILE. This is normally a list of Dired buffers, but can also be archive and tar mode buffers." - (let ((buffers nil) - (dir (file-name-directory file))) + (let* ((non-essential t) ; Do not block for remote buffers. + (buffers nil) + (dir (file-name-directory file))) (cond ((and (boundp 'tar-superior-buffer) tar-superior-buffer) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This changes the behavior. Recipe: - emacs -Q /ssh:detlef:Pictures/IMG_0040.JPG - Disable Ethernet/WLAN connection - Type 'n' in the image buffer. If the last step happens shortly after disabling the connection, nothing changes, and Emacs is blocked. This is because Emacs needs some seconds to detect the new status of the respective Tramp process (=E2=80=98exited abnormally with code 255'). However, waiting 10 seconds or longer (in my case), typing 'n' immediately returns with the message --8<---------------cut here---------------start------------->8--- user-error: No next file in this directory --8<---------------cut here---------------end--------------->8--- That sounds acceptable, isn't it? It shall also help for other dired buffers with different, already closed, Tramp connections. > > Can we put some guards in there to decide whether or not dir > and default-directory are actually on the same host before > comparing them via file-truename? If you want to go *this* direction, there would be a simple change: --8<---------------cut here---------------start------------->8--- (when (and (derived-mode-p 'dired-mode) (equal (file-remote-p dir) (file-remote-p default-directory)) (equal (file-truename dir) (file-truename default-directory))) --8<---------------cut here---------------end--------------->8--- file-remote-p doesn't do anything on wire. > -Phil (who is simply testing (not (file-remote-p default-directory)) > as an interim fix) Best regards, Michael. --=-=-=--