On Thu, Feb 13, 2025 at 11:34 AM Ship Mints <shipmints@gmail.com> wrote:
On Thu, Feb 13, 2025 at 11:23 AM Michael Albinus <michael.albinus@gmx.de> wrote:

A further remark (don't know where to do it in your code): If you
bookmark a remote file name, I recommend to keep multi-hop file names
(let-bind tramp-show-ad-hoc-proxies to t). Otherwise, a remote file name
like "/ssh:host|sudo:host:/" would be saved in your bookmark-default-file
as "/sudo:host:/", which doesn't work in the next Emacs session.

I'll experiment with multi-hop now and ensure they are correctly stored and restored.

Hi, Michael,

With tramp-show-ad-hoc-proxies bound to t *at the time of multi-hop connection*, default-directory retains the fully-qualified multi-hop file name and bookmarks work fine. I tested both shell and file bookmarks. Though files are not in scope for this patch, I ensured they worked, too.

When nil, default-directory is abbreviated, as you pointed out. I can't see a way to recover the multi-hop nature of the buffer based on just default-directory. I read through the tramp code and I can't find a way to do that.

If it is possible to do at bookmarking time, please tell me how. If this is not possible, we will highlight in the docs that tramp-show-ad-hoc-proxies must be t if users expect multi-hop bookmarks to be effective.

-Stephane