GNU bug report logs - #79474
[PATCH] (register-preview-info): sort registers in preview buffer

Previous Next

Package: emacs;

Reported by: Masatake YAMATO <yamato <at> redhat.com>

Date: Fri, 19 Sep 2025 20:04:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 79474 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79474; Package emacs. (Fri, 19 Sep 2025 20:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Masatake YAMATO <yamato <at> redhat.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 19 Sep 2025 20:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Masatake YAMATO <yamato <at> redhat.com>
To: bug-gnu-emacs <at> gnu.org
Cc: yamato <at> redhat.com
Subject: [PATCH] (register-preview-info): sort registers in preview buffer
Date: Sat, 20 Sep 2025 05:02:18 +0900 (JST)
[Message part 1 (text/plain, inline)]
Hi,

This change makes the "*Register Preview*" buffer show sorted items.
This change is helpful a user find a non-occupied register.

Thanks
[0001-register-preview-info-sort-registers-in-preview-buff.patch (text/x-patch, inline)]
From 8dff73143c5001049b647303d4bd5d19a32c15e7 Mon Sep 17 00:00:00 2001
From: Masatake YAMATO <yamato <at> redhat.com>
Date: Thu, 18 Sep 2025 03:21:22 +0900
Subject: [PATCH] (register-preview-info): sort registers in preview buffer

* lisp/register.el (register-preview): Sort alist returned from
`register-of-type-alist'.
---
 etc/NEWS         | 4 ++++
 lisp/register.el | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index bd928345283..b57440f2e0f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -799,6 +799,10 @@ with finer grained control.
 That was already the case for the "fancy" UI but is now also true in
 the default UI you get, i.e., when 'register-use-preview' is 'traditional'.
 
+---
+*** The "*Register Preview*" buffer shows sorted items.
+This is helpful a user find a non-occupied register.
+
 ** Tree-sitter
 
 +++
diff --git a/lisp/register.el b/lisp/register.el
index 9b2a10f02d7..7dbda04d176 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -246,7 +246,7 @@ register-preview
         nil
         (with-current-buffer standard-output
           (setq cursor-in-non-selected-windows nil)
-          (dolist (elem registers)
+          (dolist (elem (sort registers :key #'car))
             (when (cdr elem)
               (let ((beg (point)))
                 (insert (funcall register-preview-function elem))
-- 
2.51.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79474; Package emacs. (Sat, 20 Sep 2025 06:48:01 GMT) Full text and rfc822 format available.

Message #8 received at 79474 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Masatake YAMATO <yamato <at> redhat.com>, Thierry Volpiatto <thievol <at> posteo.net>
Cc: yamato <at> redhat.com, 79474 <at> debbugs.gnu.org
Subject: Re: bug#79474: [PATCH] (register-preview-info): sort registers in
 preview buffer
Date: Sat, 20 Sep 2025 09:47:14 +0300
> Cc: yamato <at> redhat.com
> Date: Sat, 20 Sep 2025 05:02:18 +0900 (JST)
> From:  Masatake YAMATO via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> This change makes the "*Register Preview*" buffer show sorted items.
> This change is helpful a user find a non-occupied register.

Thanks.  Thierry, any comments?  Is it okay to make this the default
behavior, and do that unconditionally?

> +---
> +*** The "*Register Preview*" buffer shows sorted items.
> +This is helpful a user find a non-occupied register.

I don't think we need to explain in NEWS why this change is for the
better, if we decide to make this change unconditionally.




This bug report was last modified today.

Previous Next


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