Subject: Re: bug#75645: Implement something like (bookmark-bmenu-list) for registers

From: Dani Moncayo <[email-masked]>
Date: Sat, 18 Jan 2025 19:07:56 +0100

On Sat, Jan 18, 2025 at 5:56 PM Thierry Volpiatto <[email-masked]> wrote:
>
> Eli Zaretskii <[email-masked]> writes:
>
> >> From: Dani Moncayo <[email-masked]>
> >> Date: Sat, 18 Jan 2025 11:50:23 +0100
> >>
> >> While analyzing source code files, I use (a lot) the functionality of
> >> keeping buffer
> >> positions in registers ((point-to-register) and (jump-to-register)).
> >>
> >> But I miss being able to display the current list of registers in a new buffer
> >> similar to the one generated for bookmarks with the command
> >> (bookmark-bmenu-list).
> >>
> >> And following the analogy, I'd like that new buffer to allow things like:
> >> * Delete one, several, or all registers.
> >> * Jump to the position pointed by some register, by clicking (or
> >> pressing ENTER) on its line.
> >>
> >> I'd very much like to have such a feature, and I think others would like it too.
> >
> > Thanks.
> >
> > Thierry, any comments or suggestions?
>
> It is easy to provide a delete register command for Emacs, however with
> the preview interface we can delete only one register at once:
>
> --8<---------------cut here---------------start------------->8---
> (customize-set-variable 'register-use-preview 'insist)
>
> (defun register-delete (register)
>   (interactive (list (register-read-with-preview "Delete register: ")))
>   (setq register-alist (delete (assoc register register-alist)
>                                register-alist)))
>
> (cl-defmethod register-command-info ((_command (eql register-delete)))
>   (make-register-preview-info
>    :types '(all)
>    :msg "Delete register `%s'"
>    :act 'modify
>    :smatch t))
> --8<---------------cut here---------------end--------------->8---

I like that (register-delete) command.  But I think it should error
out if I specify an already empty register.

I propose to add it to Emacs, and also a command to delete all registers.

I would be OK with these two.

>
> But for this use case why not using bookmarks instead of registers?
>

I use registers for temporary, single-session things (analysis of source code).
It would be cumbersome to use bookmarks for that.

> Note: Helm provides a command (helm-register) that does what you are
> asking.

Maybe I'll check it out if I find time.  Thanks.

> --
> Thierry

-- 
Dani Moncayo