Subject: bug#76165: [PATCH] ansi-osc-directory-tracker respects Tramp remote files

From: Michael Albinus <[email-masked]>
Date: Mon, 10 Feb 2025 09:16:08 +0100

Visuwesh <[email-masked]> writes:

Hi,

>> Tramp remote forms are now retained when changes to 'default-directory' are
>> detected by this filter.  Previously, for example,
>> /ssh:hostname:/home/username would be stripped to just /home/username.

> Is it necessary to invoke so many Tramp functions?

I agree. Internal Tramp functions, which are not documented in the
manual, shouldn't be used outside unless absolutely needed. They can
change w/o announcement.

> I have the following simpler advice in my config and it has worked
> faithfully for many months now.
>
>     (define-advice comint-osc-directory-tracker (:override (_ text) vz/handle-remote-paths-as-well)
>       (let ((url (url-generic-parse-url text)))
>         (when (equal (url-type url) "file")
>           (ignore-errors
>             (let ((file (url-unhex-string (url-filename url))))
>               (cd-absolute (concat (file-remote-p default-directory) file)))))))

file-remote-p returns nil for local file names. So I believe, this isn't
only an advertisement. It could go into ansi-osc-directory-tracker as-it-is.

Best regards, Michael.