ansi-osc-directory-tracker respects remote files

* etc/NEWS: ansi-osc-directory-tracker supports remote directories.

* lisp/ansi-osc.el (ansi-osc-directory-tracker):
If 'default-directory' is a remote-file form, retain that form
when 'default-directory' changes are detected.
This commit is contained in:
shipmints 2025-02-10 12:55:54 +01:00 committed by Michael Albinus
parent b92cfadc6a
commit 424fc4a56c
2 changed files with 11 additions and 1 deletions

View file

@ -533,6 +533,12 @@ It removes all the buttons in the specified region.
'comint-complete-input-ring' ('C-x <up>') is like 'minibuffer-complete-history'
but completes on comint inputs.
---
*** ansi-osc-directory-tracker now respects remote files.
Remote file forms are now retained when changes to 'default-directory'
are detected by this filter. For example, /ssh:hostname:/home/username
would have been stripped to just /home/username.
** Eshell
---

View file

@ -116,6 +116,8 @@ such as with the following command:
printf \"\\e]7;file://%s%s\\e\\\\\" \"$HOSTNAME\" \"$PWD\"
`default-directory' remote file name forms are maintained.
This functionality serves as an alternative to `dirtrack-mode'
and `shell-dirtrack-mode'."
(let ((url (url-generic-parse-url text)))
@ -124,7 +126,9 @@ and `shell-dirtrack-mode'."
;; Use `downcase' to match `url-generic-parse-url' behavior
(string= (url-host url) (downcase (system-name)))))
(ignore-errors
(cd-absolute (url-unhex-string (url-filename url)))))))
(cd-absolute
(concat (file-remote-p default-directory
(url-unhex-string (url-filename url)))))))))
;; Hyperlink handling (OSC 8)