From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files Date: Fri, 27 Dec 2019 17:18:49 +0300 Message-ID: <0ff03b20-20d8-b6c0-c876-3fd525586180@yandex.ru> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="161242"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: =?UTF-8?Q?Felici=C3=A1n_?= =?UTF-8?Q?N=C3=A9meth?= , 34343@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 27 15:19:14 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 1ikqSQ-000fn3-0g for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Dec 2019 15:19:14 +0100 Original-Received: from localhost ([::1]:35794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikqSO-0001c3-Fk for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Dec 2019 09:19:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37439) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikqSF-0001ap-Vv for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 09:19:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikqSE-0000o6-M0 for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 09:19:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50680) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ikqSE-0000ny-IV for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 09:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ikqSE-0002XA-FT for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 09:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2019 14:19: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.15774563409731 (code B ref 34343); Fri, 27 Dec 2019 14:19:02 +0000 Original-Received: (at 34343) by debbugs.gnu.org; 27 Dec 2019 14:19:00 +0000 Original-Received: from localhost ([127.0.0.1]:56653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ikqSC-0002Wt-I9 for submit@debbugs.gnu.org; Fri, 27 Dec 2019 09:19:00 -0500 Original-Received: from mail-lj1-f196.google.com ([209.85.208.196]:40045) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ikqSA-0002Wf-5K for 34343@debbugs.gnu.org; Fri, 27 Dec 2019 09:18:58 -0500 Original-Received: by mail-lj1-f196.google.com with SMTP id u1so27223972ljk.7 for <34343@debbugs.gnu.org>; Fri, 27 Dec 2019 06:18:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ewdlryTDYwDhbIJ/pdeOIymVIQEeSeiPAtaM5yKo2q4=; b=i/xha3CJLbPrVvzBdqCwOA6tjdTaE05zJzBdGf1XTanW53NgI2tcjk0clrFuziCUVb LuTLt8HnPzmBLEsQtWvpZtbkz27qpK0tIbHmpYWfxoCpFhbOxUnTHdzasjFr5oHUl4Kp sQmyv5eDlQNB4QZ5h/TpqopBE1+ToMALqyJM9xuLH14JDcI7KqsJE9os1y5Iik7fEN8z Al3j6PUvmCjfKirMsIfnCaT2ElLjOhStega6mwUkYMSaRcWKdRMjhjlGh/vw3dgX/gQr uVe4NsTcdWN/J5yVJst5SyJlKnGrPzDJdXNaXFJx5Slz28BEke7EV2N56MCcCt6B/m9R TDwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ewdlryTDYwDhbIJ/pdeOIymVIQEeSeiPAtaM5yKo2q4=; b=qGdIOf1ZCjcB3NUL1PXsics+KN+sMMluuK9P3EU+Sy+xTxLm9b9JgawxRj7IZXfXyZ tJsZMagJMmDD5CQfy+4pnjYb1vhuh/k12tgz/DTUBXa+/HKwE50v3RrmCM4LOi9rIDWS FpcVuwmRU9NnewHuZQCVyzvbiwdER0zasb9MSJjdaVexLm11Vdn0sElqMngoSF3Iz88f ACzU/2DTnTbAcXcSrQZ1NTOieDYe9dJb2uux2BClqyX1QkqbSbRD8lpX0cH5hfnMBNFW OtvqpSq5C/JLtIslZL5jWQHyQ8ef1c7/m7l1qAX1LXKOjqlY9iATa8QHw3my5VGJUQdu O3Mg== X-Gm-Message-State: APjAAAU7bsToDsJE7EQaQ6AHPW0OQjdJeYVXGzhjkOVxkDNR8X2T1TEs 6ekpEyT6s8U378GsYcb4AeOzf5dS+Z8= X-Google-Smtp-Source: APXvYqz+S/2mxm40Ln1Ly9tAO8exJ/wHEIgyDDC4I/39DTnL5tZ5MTpbLCL+b0Ettq9+uuw8OUSyKg== X-Received: by 2002:a05:651c:204f:: with SMTP id t15mr29533965ljo.240.1577456330744; Fri, 27 Dec 2019 06:18:50 -0800 (PST) Original-Received: from [192.168.1.142] ([178.252.127.239]) by smtp.googlemail.com with ESMTPSA id d20sm14577348lfm.32.2019.12.27.06.18.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Dec 2019 06:18:49 -0800 (PST) In-Reply-To: <87h81mqiq5.fsf@gmx.de> Content-Language: en-US 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:173821 Archived-At: On 27.12.2019 10:24, Michael Albinus wrote: > 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). For now, I've done some testing myself. It prepended 'remote-id' twice, now fixed. And some benchmarking. While project-find-file (the command actually using project-files) completed fairly quickly with my remote connection (1 to 3 seconds), the regexp search took a while (like 50 seconds) when there are a lot of matches (~500). 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? - Most of the time is spent in 'find-buffer-visiting'. I wonder if that function's performance can be improved. For now I've decided to avoid calling it unless really necessary (so, no free syntax highlighting for Tramp users, even when the file is already visited). Anyway, I also wanted to compare this to what we had before (dired-do-search), and that one doesn't work at all on remote directories. So it must be an improvement either way. > Your use of remote-id reminds me of comint-file-name-prefix, which > serves a similar purpose. Maybe you can check it in comint.el and the > other packages where it is used, and steal some ideas from there :-) Good suggestion, it could be a buffer-local var, or a field in xref-file-location. Or we could just avoid printing it in the group names. The simplest fix is below, but it kind of requires file-local-name to be fast: diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index bbd3940be4..5c38ae910c 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -142,7 +142,7 @@ xref-location-marker (cl-defmethod xref-location-group ((l xref-file-location)) (cl-ecase xref-file-name-display - (abs (oref l file)) + (abs (file-local-name (oref l file))) (nondirectory (file-name-nondirectory (oref l file))))) (defclass xref-buffer-location (xref-location)