Subject: bug#65039: [PATCH] Add bookmark handler for shell-mode

From: Michael Albinus <[email-masked]>
Date: Sat, 15 Feb 2025 09:43:51 +0100

Ship Mints <[email-masked]> writes:

Hi,

> Latest version of the patch attached.

Still some minor comments :-)

> +(defun shell-bookmark-make-record ()
> +  "Create a bookmark record for the current `shell-mode' buffer.
> +Handle both local and remote shell buffers.
> +Bind `tramp-show-ad-hoc-proxies' to non-nil to ensure multi-hop remote
> +connections are fully qualified."

Don't mention tramp-show-ad-hoc-proxies.

> +  (let ((bookmark-shell-file-name
> +         (cond
> +          ((file-remote-p default-directory)
> +           (with-connection-local-variables
> +            (cdr (assoc 'shell-file-name (buffer-local-value
> +                                          'connection-local-variables-alist
> +                                          (current-buffer))))))
> +          (shell-file-name shell-file-name)
> +          (t sh-shell-file))))

This can be expressed simpler:

  (let ((bookmark-shell-file-name
        (or (connection-local-value shell-file-name) sh-shell-file)))

> +(defun shell-bookmark-jump (bookmark)
> +  "Default BOOKMARK handler for shell buffers.
> +Create a shell buffer with its `default-directory', shell process, and
> +buffer name from the bookmark.  If there is an existing shell buffer of
> +the same name, default shell-mode behavior is to reuse that buffer.
> +
> +For a remote shell `default-directory' will be the remote file name.
> +Remote shell buffers reuse existing connections that match the remote
> +file name, or may prompt you to create a new connection.  Bind
> +`tramp-show-ad-hoc-proxies' to non-nil to ensure multi-hop remote
> +connections are fully qualified.

Don't mention tramp-show-ad-hoc-proxies.

Best regards, Michael.