Subject: bug#79084: closed (Re: bug#79084: [PATCH] Use normal buffer order in eww-switch-to-buffer)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 13 Sep 2025 22:33:02 +0000

Your bug report

#79084: [PATCH] Use normal buffer order in eww-switch-to-buffer

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79084: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79084
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79084: [PATCH] Use normal buffer order in eww-switch-to-buffer
From: Stefan Monnier <[email-masked]>
To: James Thomas <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Sat, 13 Sep 2025 18:32:07 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> The original reason for the 'nreverse' seems to have been for cycling
> using 's RET s RET...' ala ERC (bug#22244) - that won't, obviously, work
> with this put in - but the 'right' way to allow doing that would be by
> giving it a more specific 'category' (describe-variable
> 'completion-extra-properties), isn't it?

Indeed.

> And, in that case, why not get rid of the cl- as well?

Fine by me, pushed to `master`, thank you.

        Stefan

Subject: [PATCH] Use normal buffer order in eww-switch-to-buffer
From: James Thomas <[email-masked]>
To: [email-masked]
Date: Thu, 24 Jul 2025 10:43:07 +0530
List-Id: <debbugs-submit.debbugs.gnu.org>

Severity: wishlist
Tags: patch

The original reason for the 'nreverse' seems to have been for cycling
using 's RET s RET...' ala ERC (bug#22244) - that won't, obviously, work
with this put in - but the 'right' way to allow doing that would be by
giving it a more specific 'category' (describe-variable
'completion-extra-properties), isn't it?

From 192966ce939919767dce155787ff98cd5c1deccd Mon Sep 17 00:00:00 2001
From: James Thomas <[email-masked]>
Date: Tue, 22 Jul 2025 08:21:04 +0530
Subject: [PATCH] * lisp/net/eww.el (eww-switch-to-buffer): Use normal buffer
 order.

---
 lisp/net/eww.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index cdddfe3700e..bfc57c9181b 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2397,7 +2397,7 @@ eww-switch-to-buffer
   "Prompt for an EWW buffer to display in the selected window.
 If no such buffer exist, fallback to calling `eww'."
   (interactive nil eww-mode)
-  (let ((list (cl-loop for buf in (nreverse (buffer-list))
+  (let ((list (cl-loop for buf in (buffer-list)
                        if (and (eww--buffer-p buf)
                                (not (eq buf (current-buffer))))
                        collect (buffer-name buf))))
-- 
2.50.0

And, in that case, why not get rid of the cl- as well?

From 5c111c0d44eb08030df69a79da344b7e1a7a32ec Mon Sep 17 00:00:00 2001
From: James Thomas <[email-masked]>
Date: Tue, 22 Jul 2025 08:28:58 +0530
Subject: [PATCH] Prefer seq- functions to cl- in eww-switch-to-buffer

Prefer seq- functions to cl- in eww-switch-to-buffer

* lisp/net/eww.el (eww-switch-to-buffer):
---
 lisp/net/eww.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index bfc57c9181b..74e9491c2c9 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2397,23 +2397,23 @@ eww-switch-to-buffer
   "Prompt for an EWW buffer to display in the selected window.
 If no such buffer exist, fallback to calling `eww'."
   (interactive nil eww-mode)
-  (let ((list (cl-loop for buf in (buffer-list)
-                       if (and (eww--buffer-p buf)
-                               (not (eq buf (current-buffer))))
-                       collect (buffer-name buf))))
+  (let ((list (seq-filter
+               (lambda (buf)
+                 (and (eww--buffer-p buf) (not (eq buf (current-buffer)))))
+               (buffer-list))))
     (if list
         (pop-to-buffer-same-window
          (if (length= list 1)
              (car list)
            (completing-read "Switch to EWW buffer: "
                             (completion-table-with-metadata
-                             list
+                             (mapcar #'buffer-name list)
                              `((category . buffer)
                                (annotation-function
                                 . ,(lambda (buf)
                                      (with-current-buffer buf
                                        (format " %s" (eww-current-url)))))))
-                            nil t)))
+                            nil t nil nil (car-safe list))))
       (call-interactively #'eww))))
 
 (defun eww-toggle-fonts ()
-- 
2.50.0

--