From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files Date: Fri, 27 Dec 2019 18:57:31 +0100 Message-ID: <87mubdps6s.fsf@gmx.de> References: <9d65284f-7a64-5e9c-ab02-fbbd1be41689@yandex.ru> <87r2bt1tio.fsf@gmx.de> <2cfd53b2-8202-a321-a853-da0c949b0f15@yandex.ru> <6cf8bfa8-3873-d3db-9139-854359027e8a@yandex.ru> <87h81mqiq5.fsf@gmx.de> <0ff03b20-20d8-b6c0-c876-3fd525586180@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="64521"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: =?UTF-8?Q?Felici=C3=A1n_?= =?UTF-8?Q?N=C3=A9meth?= , 34343@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 27 18:59:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ikttF-000Gbn-Is for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Dec 2019 18:59:09 +0100 Original-Received: from localhost ([::1]:37674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikttE-0001bS-66 for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Dec 2019 12:59:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50520) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iktsD-0001Zz-GC for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 12:58:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iktsA-0007ko-QN for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 12:58:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51793) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iktsA-0007kc-Hg for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 12:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iktsA-0008JN-H0 for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 12:58: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: Fri, 27 Dec 2019 17:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34343 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 34343-submit@debbugs.gnu.org id=B34343.157746946231921 (code B ref 34343); Fri, 27 Dec 2019 17:58:02 +0000 Original-Received: (at 34343) by debbugs.gnu.org; 27 Dec 2019 17:57:42 +0000 Original-Received: from localhost ([127.0.0.1]:57766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iktrp-0008In-Ry for submit@debbugs.gnu.org; Fri, 27 Dec 2019 12:57:42 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:53775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iktrn-0008Ia-RR for 34343@debbugs.gnu.org; Fri, 27 Dec 2019 12:57:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1577469453; bh=hIOfPBIzWuiVRM1JjKBl7AQ1PJhe24rZcH2xToUpoxM=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=An6yFsfDt5nQOOWLpcs4NS4pGMZlrwWK2RaaFYt6xK14rh0NLspiTNeNIcX4mwgcj bP8LqAWoy1glXAAkrsZe0XOUHpVeGqBJ3Pf8nkE9VFY8YyHDeQ+mAwIZn4fCv4BGsU Q/bwT9pMy4NCm4tRTtdW/f6hEYv/CKj+0LV01BOc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from detlef.gmx.de ([212.86.41.79]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MwQXH-1jawDh3H6b-00sKwQ; Fri, 27 Dec 2019 18:57:32 +0100 In-Reply-To: <0ff03b20-20d8-b6c0-c876-3fd525586180@yandex.ru> (Dmitry Gutov's message of "Fri, 27 Dec 2019 17:18:49 +0300") X-Provags-ID: V03:K1:8lGNum3oXqUfTHwzy0TVNp8Vf0wE4RlCb0UDA0WCdrCgA97ThXJ DH1LTcvxvrfLMufggxizfUMJdVQvi21oeeBJZQF3doE3o+A/0Jft7kGfZVAZ+YV4wX0+350 d+4mbQkL+mkhG7ZlGlxiU/iaYNnAzlXJhlurG5y/61Kze/r/FlbaGqeXDodMN5Chb/05eS/ jfYE87kelRtvu4QCfTkQA== X-UI-Out-Filterresults: notjunk:1;V03:K0:XZDcORWgcB4=:xi0xhDMa+iAitVpU5qgQKh ph5XydbCIqF1AizcoH2SIi44YL2rLkSDQMqf4UIanL9bEztKQE2PLjZNyYaVE9NHjCEjLwXYO hANn/snLpW7TNVx0rEN5Dejmw/rKhlvKZiq/HKfkNSDwCpmLg/1CUKA8karVP6mjYXVCz+UW0 Tu07CTCMwvL9Mhx0VYWPOJGT1chC++GLSfDZ7AnsWNXpKPjqLf4OgRYmVUt6AIq0pVRZDJg7K 6rbp6zVHQv8f/+iPDnito6gnvQUWo+umTVz9xaD7vOAZdVDYVMlP0xGWv6Woub6Rhu/GA/V8/ mtCM7yc44iTKgMLqI4OPPy1NTyg/LPorReYlNZFmXc7x1O07LeA55TAH6wHU3BnTU6s1p4rM0 hGoDQ0dC/DghdfWF37pAnbCHckh1E5cwL2OwiFn4Cm0Z5ZzU6srurAIsiqTnP4jB+1nWj6anK vwwbQ5F/M70ePtwiR32dwuIlFLGysTOFmW0hcfr7xIlDUANl8HsF6zL+Ucmz/zBu+q8lXR/mz zapaCN6rufzqCQThuf4/Zc13fInlv7WPP4admOW0HwhJc9PYeZ+cKRKndcfSj5+fRMKC9Xw4m LTTpn9hjpmAqlHoc4QGaXgsNRGWE/KWvgaciWA7k/ACscTy1R+pplHcstJEFB73UZtzULgooS 1eXcr5/NHdDUHAXlmQiSrJEFwX9PvI3JNrRSDOhANAmpUDRdvJCQLHcB9ycy0f4/Kt7UGyXEQ 2BBxL4vzsQbc4nhq47rBat9sCW/U4DjOz2XE1+BQQrweiiTfDVOKVHbmqq266/mGSm/xxFjy X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173831 Archived-At: --=-=-= Content-Type: text/plain Dmitry Gutov writes: Hi Dmitry, >> The patch looks reasonable to me. Since I don't use project-files, I >> can't say whether this works correctly. > > Unless it's a religious position, you can test it with: > > M-x project-find-regexp > > or > > M-x dired-do-find-regexp (also bound to 'A' in Dired) > > (the latter since one of my yesterday's commits). No religious barrier here :-) > For now, I've done some testing myself. It prepended 'remote-id' > twice, now fixed. I've tested with the emacs-27 branch, and it seems to work. > Things I've noticed: > > - (mapcar #'file-local-name files) takes like ~2 seconds when FILES > only has ~3000 elements. The same code completes instantly on a > local machine. Shouldn't it be the same? file-local-name uses internally file-remote-p, which calls expand-file-name if the connection is already established. Not needed in case of local names. Could you pls test the appended patch, whether it improves performance? Best regards, Michael. --=-=-= Content-Type: text/plain Content-Disposition: attachment diff --git a/lisp/tramp.el b/lisp/tramp.el index 0dbbfa59..a25b2715 100644 --- a/lisp/tramp.el +++ b/lisp/tramp.el ;; This file is part of GNU Emacs. @@ -3361,10 +3361,12 @@ User is always nil." (let* ((v (tramp-dissect-file-name filename)) (p (tramp-get-connection-process v)) (c (and (process-live-p p) - (tramp-get-connection-property p "connected" nil)))) - ;; We expand the file name only, if there is already a connection. + (tramp-get-connection-property p "connected" nil))) + (e (and c (not (eq identification 'localname))))) + ;; We expand the file name only, if there is already a + ;; connection, and IDENTIFICATION is not `localname'. (with-parsed-tramp-file-name - (if c (expand-file-name filename) filename) nil + (if e (expand-file-name filename) filename) nil (and (or (not connected) c) (cond ((eq identification 'method) method) --=-=-=--