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

From: Thierry Volpiatto <[email-masked]>
Date: Sat, 18 Jan 2025 18:26:29 +0000

Dani Moncayo <[email-masked]> writes:

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

You can't (try to) delete an empty register with the preview.

-- 
Thierry