bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34343: [PATCH] Make project--find-regexp-in-files work with remote f


From: Michael Albinus
Subject: bug#34343: [PATCH] Make project--find-regexp-in-files work with remote files
Date: Tue, 07 Jan 2020 15:29:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Dmitry Gutov <address@hidden> writes:

> (defun file-local-name (file)
>   "Return the local name component of FILE.
> This function removes from FILE the specification of the remote host
> and the method of accessing the host, leaving only the part that
> identifies FILE locally on the remote system.
> The returned file name can be used directly as argument of
> `process-file', `start-file-process', or `shell-command'."
>   (let ((handler (find-file-name-handler file 'file-local-name)))
>     (if handler
>         (funcall handler 'file-local-name file)
>       ;; Until all the implementations switch over,
>       ;; not sure how long to keep the compatibility here.
>       (or (file-remote-p file 'localname) file))))

handler would be tramp-file-name-handler, so I don't see how it helps.

> Well, if you like the following piece of code, I guess we could live
> with that.
>
>       (setq files (mapcar
>                    (if (tramp-tramp-file-p dir)
>                        #'tramp-file-local-name
>                        #'file-local-name)
>                    files)))

That would work. If you are sure that you will handle only Tramp based
remote files, you could simplify this to

(setq files (mapcar #'tramp-file-local-name files))

> By the way, I have no idea what to do about having tramp-tramp-file-p
> called twice.

Take the tramp-tramp-file-p call out of mapcar, like

(let ((fun (if (tramp-tramp-file-p dir)
               #'tramp-file-local-name #'file-local-name)))
  (setq files (mapcar fun files)))

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]