GNU bug report logs - #65039
30.0.50; [PATCH] Add bookmark handler for M-x shell

Previous Next

Package: emacs;

Reported by: Protesilaos Stavrou <info <at> protesilaos.com>

Date: Thu, 3 Aug 2023 14:42:01 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Fixed in version 31.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ship Mints <shipmints <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 65039 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, prot <at> protesilaos.com, Visuwesh <visuweshm <at> gmail.com>
Subject: bug#65039: [PATCH] Add bookmark handler for shell-mode
Date: Thu, 13 Feb 2025 11:34:20 -0500
[Message part 1 (text/plain, inline)]
On Thu, Feb 13, 2025 at 11:23 AM Michael Albinus <michael.albinus <at> gmx.de>
wrote:

> Ship Mints <shipmints <at> gmail.com> writes:
>
> > +(defcustom shell-bookmark-name-function
> #'shell-bookmark-name-from-default-directory
> > +  "Function to generate a shell bookmark name.
> > +The default is `shell-bookmark-name', which see."
> > +  :group 'shell
> > +  :type `(choice (function-item
> ,#'shell-bookmark-name-from-default-directory)
> > +                 (function-item ,#'shell-bookmark-name-from-buffer-name)
> > +                 function)
>
> Wouldn't this be sufficient?
>
> --8<---------------cut here---------------start------------->8---
>   :type '(choice (function-item shell-bookmark-name-from-default-directory)
>                  (function-item shell-bookmark-name-from-buffer-name)
>                  function)
> --8<---------------cut here---------------end--------------->8---
>

It would be but referencing functions as functions vs. naked symbols seems
like a better style?


> > +  (replace-regexp-in-string "\\(.*\\)<[[:digit:]]+>\\'"
> > +                            "\\1"
> > +                            (buffer-name)))
>
> --8<---------------cut here---------------start------------->8---
>   (replace-regexp-in-string "<[[:digit:]]+>\\'" "" (buffer-name)))
> --8<---------------cut here---------------end--------------->8---
>

I'll review that regexp. Thanks for that simplification.


> 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.

-Stephane
[Message part 2 (text/html, inline)]

This bug report was last modified 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.