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#51622: 29.0.50; [PATCH v3] Abbreviate remote home directories in `abbreviate-file-name' Date: Mon, 15 Nov 2021 17:59:25 +0100 Message-ID: <87o86l9wya.fsf@gmx.de> References: <5ac0b5f3-302c-2f96-771c-8d38088aa573@gmail.com> <87mtmhmh60.fsf@gmx.de> <87a6ihchbo.fsf@gmx.de> <87sfw7u7zw.fsf@gmx.de> <9c2f6b1b-9091-3996-e414-0de4b1618f7f@gmail.com> <874k8eg5mf.fsf@gmx.de> <6deae031-0bbd-9dec-d9d1-3e74e45acaeb@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21635"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 51622@debbugs.gnu.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 15 18:01:13 2021 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 1mmfM0-0005Uw-90 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Nov 2021 18:01:12 +0100 Original-Received: from localhost ([::1]:41032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmfLz-00031o-7Y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Nov 2021 12:01:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmfKy-0002e3-BT for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 12:00:10 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mmfKt-0000DB-1g for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 12:00:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mmfKs-0000Ma-Vf for bug-gnu-emacs@gnu.org; Mon, 15 Nov 2021 12:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Nov 2021 17:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51622 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51622-submit@debbugs.gnu.org id=B51622.16369955761328 (code B ref 51622); Mon, 15 Nov 2021 17:00:02 +0000 Original-Received: (at 51622) by debbugs.gnu.org; 15 Nov 2021 16:59:36 +0000 Original-Received: from localhost ([127.0.0.1]:55982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmfKS-0000LM-BE for submit@debbugs.gnu.org; Mon, 15 Nov 2021 11:59:36 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:58091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mmfKP-0000L6-Qj for 51622@debbugs.gnu.org; Mon, 15 Nov 2021 11:59:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1636995567; bh=XsqZ5cgYeGtUZNUDmdbgev892SmiLrppecqqi8hy4qs=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=Fbn56+ZaXenPbSBjIjM4eStnwVFXPn5S+GS8/fsJPF2MSQWMLaEkSHE3Pfhv4pXZq UU56mK3P6jRdlG4EKfhDkHVVgjczWL26Y+K39MoI9JMWoduRrsJ+pxZVhZl0OPx3T1 0joZ19EdTraOH+aGpCIutWmBVWqBwB74oeDaSUco= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([79.140.112.102]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MrQIv-1mIZpZ3esR-00oYLm; Mon, 15 Nov 2021 17:59:26 +0100 In-Reply-To: <6deae031-0bbd-9dec-d9d1-3e74e45acaeb@gmail.com> (Jim Porter's message of "Sun, 14 Nov 2021 22:58:31 -0800") X-Provags-ID: V03:K1:qv9hIeEjQgL6C4z7i6e4jMYk7P/AKW92cNX6tUzlYKkktKSKF5C 7TtkA1YhYSlhS8VOv1Zp6EakPx5EFLsMulkpxQ1e0ded39Y9GCy7kIw+2rktSsljIIPP2Gd FbzzhHmoWC/EvCAGVAN1i+tOTWin6qYPH2O5fWQtbvEeFYIG4RSKpoMspArlfujxr/rf1NA xKb0GQOtdxZj78oCcSn+Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:cnKCmTGAXs8=:rUzX7gEhjonF4MPzrId1Jk nedL5G9ay6s0csa/jk2un5bUFl/JxHATIkNZDBytsS94FL3LF/4SE8ybJ/374GjHhmKA1GlWe JDDYqpYvNtaHNfhBVskFD7wZKJIMpk30KAqDPKFtFGjMelvZzIIwnsfju1RQZfuMzzaTmkwPT h1/GTSiLCGPbUx/U/Re2G32/XJZW+XHroIj73ffRko5e2qwGJYT42TurRLcQjzMgyKCdAFRTH Kp4v4Svmx5CdPcRiCSrkUUTJ9nhvf6CpTuJvCo+RudCGIYmh5kjyQKS4dwTl4nW2Y7sRnYgTC 6/sqgzjisoehvjpCV/k0dr0pgVIsX3Fpy/MNHT/ktiwlrDgmDVSTA0iFoJU5sURofCgr6rpoe vHk6Axm5J/s9kGm6OQR4K5loVqz01KRVIh+IQexPXkN7rQedEv23hoCAkpvml9Ejgm9/gcy80 tWiFnQfDRL7szN4ar2tobHdmbCO1GvPulrnfxAuv3It2tpZ4McPJr7LbmyAmGbHJkvx/bTtRe ZMmSDQ4Il/smC8qiVkzad6teiwNthxjkNysxYEamzsvjwFJulf3vHXupWijSNpiohk8bXYhxN zLwNsmyiWr3AWcemgmD16H6vgYXw+3jVS4UHCj0a9Eg/1fcd8lLopf9TIc2tGl15NuDw7aTa3 azbnzvLWFoI7iJ0Iph/oFiuO49cMQed19U8T6LXByrZ1jWmhp8nYcvP1t2hTtyvFW2WKK3FqC utRmb4FvErIWBGtpCws87uhEXpRsm7gAcm65TJJbwbFQC9rgBDFD33x/QeL8Sr+r5W0Jd+KE 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:220063 Archived-At: Jim Porter writes: Hi Jim, >> Thanks. However, I believe this test shall be called >> `files-tests-file-name-non-special-file-abbreviate-file-name', like the >> other non-special tests. And perhaps it shall be located prior >> `files-tests-file-name-non-special-access-file'. > > Ok, done. Thanks, I've pushed this to the master branch. >> But it shouldn't be too hard to determine the defaults. We have >> tramp-default-method{-alist}, tramp-default-user{-alist}, and >> tramp-default-host{-alist}. All needed information is there. > > Right, that confirms what I suspected. I'll try to look into this in > more detail later when I get the chance. Would be interesting to see the result :-) >>> I also attached a slightly-updated benchmark script as well as new >>> results. Performance on local file names is the same as before the >>> patch, and just slightly faster than before with Tramp file >>> names. (Most of the performance improvements here happened in >>> bug#51699, so I mainly wanted to maintain the current performance in >>> this patch.) >> Good, no regression :-) > > Fixing your comments below *did* regress performance for abbreviating > Tramp file names compared to current master (it takes 1.47x as long > now in the worst case), but it's still considerably faster than Emacs > 28. I've attached updated benchmark results to show the difference. Yes, that's the price we have to pay for clean code. I've explained why it is needed. However, the `tramp-file-name-handler' machinery has been grown over 20+ years. I'm not aware of useless stuff, but maybe it's worth to have an *external* look at this wrt performance. Are you interested? >> Well, I believe we can implement abbreviation also for other Tramp >> backends, like in tramp-sudoedit.el. So it might be better to call this >> handler `tramp-handle-abbreviate-file-name'. > > Done. I added this for the sudoedit and smb methods, since both support > "~" expansion in `expand-file-name'. That *should* be sufficient, but > I've never used either of those methods, so I could be wrong... Thanks. I didn't find the time to check it for these methods, but it's on my TODO for next days. >> Please use `case-insensitive-p'. We don't know whether there will be >> other implementation for this magic function in the future. And we shall >> not bypass the checks in `tramp-file-name-handler', which are important >> for parallel invocations of Tramp handlers. > > Fixed (same with `expand-file-name'). These changes slow things down a > fair bit, but that's mostly due to checking for the right file name > handler more often. Like I said above though, it's still a lot faster > than Emacs 28 (thanks to bug#51699). I've committed everything to master. Then I ran the regression tests, and there were indeed some few surprises. All of them shall be fixed now with my commit after yours. I tend to close this bug report now, since everything reported has been implemented. The open points don't need this bug anymore for progress. WDYT? Best regards, Michael.