GNU bug report logs - #34343
[PATCH] Make project--find-regexp-in-files work with remote files

Previous Next

Package: emacs;

Reported by: Felicián Németh <felician.nemeth <at> gmail.com>

Date: Wed, 6 Feb 2019 08:19:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 34343 <at> debbugs.gnu.org, Felicián Németh <felician.nemeth <at> gmail.com>
Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files
Date: Fri, 27 Dec 2019 17:18:49 +0300
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)





This bug report was last modified 3 years and 303 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.