40.7 Shell Bookmarks

Shell mode buffers can be bookmarked, and both local and remote (see Remote Files) shell buffers are supported. See Bookmarks.

Opening, or “jumping” to, a bookmarked shell restores its buffer name, its current directory, and will create a remote connection, as necessary, using the shell command you used to create the remote buffer.

The option shell-bookmark-name-function can be customized to suit your preferences. It defaults to the function shell-bookmark-name-from-default-directory which uses the final component of the buffer’s default-directory. An alternate function, shell-bookmark-name-from-buffer-name, uses the buffer’s name with its rename-uniquely suffix brackets "<>" stripped. You can bind this option to your own function.

You can inhibit remote connections when you open a remote shell bookmark. This is useful when you restore sessions with desktop-load, or via another session-management package, to avoid time delays establishing connections. You can establish a connection on an unconnected remote buffer using the command C-x C-v (find-alternate-file). To inhibit a connection interactively, give a prefix argument before invoking the open/jump bookmark menu item, or before invoking the command bookmark-jump. 30 31

Note: Before creating ad-hoc multi-hop remote connections, customize either or both: tramp-save-ad-hoc-proxies to non-nil to persist proxy routes. tramp-show-ad-hoc-proxies to non-nil to ensure connections are fully qualified. This is helpful if you use the same persisted bookmarks file on multiple hosts.

See Ad-hoc multi-hops in The Tramp Manual.


Footnotes

(30)

To inhibit a connection programmatically, refer to the documentation for the variable shell-bookmark-jump-non-essential.

(31)

To properly handle multi-hop remote connections, refer to the documentation for the function shell-bookmark-jump.