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

From: Michael Albinus <[email-masked]>
Date: Mon, 10 Feb 2025 15:19:53 +0100

Visuwesh <[email-masked]> writes:

Hi,

> That reminds me why my :override advice was simpler.  Indeed, I had to
> get rid of that test to ensure that the function would work as intended
> for remote shell buffers.  It never made much sense IMO and I got the
> impression that it is in place as a "let's be absolutely sure" measure.
> I can say that I face no issues with the test omitted thus far. It could
> be a product of me being in control of $PS1 for local and remote shells
> though.

Well. The host part of the URL could be anything, and must not be the
same like the current host name. So perhaps the check could be like
this, "to be absolutely sure":

--8<---------------cut here---------------start------------->8---
  (when-let* ((url (url-generic-parse-url text))
              ((string= (url-type url) "file"))
              ((or (null (url-host url))
                   ;; Use `downcase' to match `url-generic-parse-url' behavior
                   (string= (url-host url)
                            (downcase
                             (or (file-remote-p default-directory 'host)
                                 (system-name)))))))
    (ignore-errors
      (cd-absolute
       (concat (file-remote-p default-directory)
               (url-unhex-string (url-filename url)))))))
--8<---------------cut here---------------end--------------->8---

WDYT?

Best regards, Michael.