From: Dmitry Gutov <dgutov@yandex.ru>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: "Felicián Németh" <felician.nemeth@gmail.com>, 34343@debbugs.gnu.org
Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files
Date: Mon, 6 Jan 2020 17:33:06 +0300 [thread overview]
Message-ID: <81589ba9-0f93-599d-e55f-6605479454b0@yandex.ru> (raw)
In-Reply-To: <87blrksxco.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]
Hi Michael,
On 03.01.2020 11:28, Michael Albinus wrote:
> Yes. But in case you want to be generic (handling all possible remote
> file names, not only the Tramp implementation), you must use the file
> name handler implementation, as it is described in
> (info "(elisp) Magic File Names")
As I've shown before, the generic dispatch is far from being the
bottleneck at the moment. tramp-file-name-handler doing a lot of
unrelated work is what takes the most time.
> In case you want to go your own path, I could provide you an own
> tramp-file-local-name function, which bypasses this mechanism:
Thank you. I see you've already pushed this function to the release branch.
I could use it like this, sure, but we can have a significant
performance improvement and keep the generic-ness at the same time.
The simplest option is below. It works fast enough in my testing (*); a
bit slower than calling tramp-file-local-name directly, but not by much.
Certainly much faster than the current state of affairs.
It's a bit messy, but I'm not sure how to structure the resulting
function best. There are several ways, though. What do you think?
(*) The 1'000'000 files example was an extreme one, to optimize for when
files are local. The 10'000 file project is a real one, on the other hand.
P.S. BTW, I think our convention is not to call save-match-data unless
obviously required. If the caller needs to save the match data, it will
use it itself.
[-- Attachment #2: tramp-local-name.diff --]
[-- Type: text/x-patch, Size: 1080 bytes --]
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 85330e98aa..34438bd276 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2322,6 +2322,9 @@ tramp-locker
(defun tramp-file-name-handler (operation &rest args)
"Invoke Tramp file name handler for OPERATION and ARGS.
Fall back to normal file name handler if no Tramp file name handler exists."
+ (if (and (eq operation 'file-remote-p)
+ (eq (cadr args) 'localname))
+ (tramp-file-local-name (car args))
(let ((filename (apply #'tramp-file-name-for-operation operation args))
;; `file-remote-p' is called for everything, even for symbolic
;; links which look remote. We don't want to get an error.
@@ -2415,7 +2418,7 @@ tramp-file-name-handler
;; When `tramp-mode' is not enabled, or the file name is quoted,
;; we don't do anything.
- (tramp-run-real-handler operation args))))
+ (tramp-run-real-handler operation args)))))
(defun tramp-completion-file-name-handler (operation &rest args)
"Invoke Tramp file name completion handler for OPERATION and ARGS.
next prev parent reply other threads:[~2020-01-06 14:33 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 8:18 bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files Felicián Németh
2019-02-14 1:17 ` Dmitry Gutov
2019-02-15 18:53 ` Felicián Németh
[not found] ` <a54e7498-4ead-dd6f-6a2e-3919ab035b23@yandex.ru>
2019-02-27 9:15 ` Michael Albinus
2019-03-06 7:47 ` Felicián Németh
2019-03-06 14:33 ` Dmitry Gutov
2019-03-06 14:44 ` Dmitry Gutov
2019-03-08 8:28 ` Felicián Németh
2019-12-26 14:04 ` Dmitry Gutov
2019-12-27 8:24 ` Michael Albinus
2019-12-27 14:18 ` Dmitry Gutov
2019-12-27 17:57 ` Michael Albinus
2019-12-28 10:21 ` Michael Albinus
2019-12-28 14:48 ` Dmitry Gutov
2019-12-28 18:56 ` Michael Albinus
2019-12-28 14:46 ` Dmitry Gutov
2019-12-28 18:46 ` Michael Albinus
2019-12-29 0:15 ` Dmitry Gutov
2019-12-29 12:34 ` Michael Albinus
2019-12-29 13:14 ` Dmitry Gutov
2020-01-01 12:29 ` Michael Albinus
2020-01-02 1:22 ` Dmitry Gutov
2020-01-02 10:48 ` Michael Albinus
2020-01-03 0:52 ` Dmitry Gutov
2020-01-03 9:28 ` Michael Albinus
2020-01-06 14:33 ` Dmitry Gutov [this message]
2020-01-06 18:48 ` Michael Albinus
2020-01-07 3:23 ` Dmitry Gutov
2020-01-07 9:19 ` Michael Albinus
2020-01-07 13:40 ` Dmitry Gutov
2020-01-07 14:29 ` Michael Albinus
2020-01-07 14:34 ` Dmitry Gutov
2021-07-22 13:00 ` Lars Ingebrigtsen
2021-07-24 19:42 ` Dmitry Gutov
2021-07-25 6:41 ` Lars Ingebrigtsen
2020-01-03 0:57 ` Dmitry Gutov
2020-01-06 17:29 ` Felician Nemeth
2020-01-07 3:23 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81589ba9-0f93-599d-e55f-6605479454b0@yandex.ru \
--to=dgutov@yandex.ru \
--cc=34343@debbugs.gnu.org \
--cc=felician.nemeth@gmail.com \
--cc=michael.albinus@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).