This is a continuation of the discussion in this bug report. I've had shell bookmark support privately for a while, and I see Prot had something similar, as I'm sure many others do. One of the open items from Prot's last message was accommodating remote shells.
The attached patch aims to address both local and remote shells. There is a feature to inhibit remote connections useful when restoring sessions with
'desktop-load' (or another session management package), where the time delays to establish a connection for each remote shell can be long. When you reload an unconnected remote buffer using 'C-x C-v', a connection will be initiated.
Remote shell bookmarks remember the buffer's remote 'default-directory'
at the time you create a bookmark, along with the shell used to
start the remote shell. I think this is something Visuwesh commented on and which this patch attempts to address.
There are two options for shell bookmark names, one using default-directory similar to eshell, and one using buffer name (my shell buffer names are automated in a style I prefer).
I cc'd Michael Albinus on this since it touches remote features and he may want to scrutinize what's in this patch. Testing this patch is what led me to help fix the bug in ansi-osc-directory-tracker.
Let me know what you all think.
-Stephane