GNU bug report logs - #76165
[PATCH] ansi-osc-directory-tracker respects Tramp remote files

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Sun, 9 Feb 2025 19:06:01 UTC

Severity: normal

Tags: patch

Fixed in version 31.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Visuwesh <visuweshm <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 76165 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: bug#76165: [PATCH] ansi-osc-directory-tracker respects Tramp remote files
Date: Mon, 10 Feb 2025 13:57:58 +0530
[திங்கள் பிப்ரவரி 10, 2025] Michael Albinus wrote:

> Visuwesh <visuweshm <at> gmail.com> 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.

Indeed, I was following what file-remote-p says itself:

    Tip: You can use this expansion of remote identifier components
         to derive a new remote file name from an existing one.  For
         example, if FILE is "/sudo::/path/to/file" then

           (concat (file-remote-p FILE) "/bin/sh")

         returns a remote file name for file "/bin/sh" that has the
         same remote identifier as FILE but expanded; a name such as
         "/sudo:root <at> myhost:/bin/sh".
   

> Best regards, Michael.




This bug report was last modified 102 days ago.

Previous Next


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