Subject: bug#78372: closed (Re: bug#78372: [PATCH] Fix `eww-switch-to-buffer' when resorting to `eww')

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 17 May 2025 09:07:02 +0000

Your bug report

#78372: [PATCH] Fix `eww-switch-to-buffer' when resorting to `eww'

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

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

Subject: Re: bug#78372: [PATCH] Fix `eww-switch-to-buffer' when resorting to `eww'
From: Eli Zaretskii <[email-masked]>
To: Manuel Giraud <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 17 May 2025 12:06:40 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: Lars Magne Ingebrigtsen <[email-masked]>
> From: Manuel Giraud <[email-masked]>
> Date: Sun, 11 May 2025 14:48:13 +0200
> 
> When `eww-switch-to-buffer' is resorting to `eww', having
> `completion-extra-properties' bound prevent `eww' to correctly complete
> the suggested URIS.  This patch fixes this issue.

Thanks, installed on master, and closing the bug.

Subject: [PATCH] Fix `eww-switch-to-buffer' when resorting to `eww'
From: Manuel Giraud <[email-masked]>
To: [email-masked]
Date: Sun, 11 May 2025 14:48:13 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Hi,

When `eww-switch-to-buffer' is resorting to `eww', having
`completion-extra-properties' bound prevent `eww' to correctly complete
the suggested URIS.  This patch fixes this issue.

In GNU Emacs 31.0.50 (build 1, x86_64-unknown-openbsd7.7) of 2025-05-11
 built on computer
Repository revision: 3975094f1d96680fe73232ca4216733904ebecd0
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: OpenBSD computer 7.7 GENERIC.MP#658 amd64

Configured using:
 'configure CC=egcc CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=no
 --with-toolkit-scroll-bars=no --without-cairo
 --without-compress-install'

>From ec9e306f7ad449ad14a53d5b9d127ff0ad7effa9 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Sun, 11 May 2025 14:40:18 +0200
Subject: [PATCH] Fix `eww-switch-to-buffer' when resorting to `eww'

* lisp/net/eww.el (eww-switch-to-buffer): Do not bound
`completion-extra-properties' before calling `eww'.
---
 lisp/net/eww.el | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index c11e378c714..e59df6d1699 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2324,26 +2324,26 @@ 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 ((completion-extra-properties
-         `(:annotation-function
-           ,(lambda (buf)
-              (with-current-buffer buf
-                (format " %s" (eww-current-url))))))
-        (curbuf (current-buffer))
-        (list (cl-loop for buf in (nreverse (buffer-list))
+  (let ((list (cl-loop for buf in (nreverse (buffer-list))
                            if (with-current-buffer buf (derived-mode-p 'eww-mode))
                            return buf)))
     (if list
-        (pop-to-buffer-same-window
-         (read-buffer "Switch to EWW buffer: "
-                      list
-                      t
-                      (lambda (bufn)
-                        (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn)))
-                        (and (with-current-buffer bufn
-                               (derived-mode-p 'eww-mode))
-                             (not (eq bufn curbuf))))))
-      (call-interactively 'eww))))
+        (let ((completion-extra-properties
+               `(:annotation-function
+                 ,(lambda (buf)
+                    (with-current-buffer buf
+                      (format " %s" (eww-current-url))))))
+              (curbuf (current-buffer)))
+          (pop-to-buffer-same-window
+           (read-buffer "Switch to EWW buffer: "
+                        list
+                        t
+                        (lambda (bufn)
+                          (setq bufn (if (consp bufn) (cdr bufn) (get-buffer bufn)))
+                          (and (with-current-buffer bufn
+                                 (derived-mode-p 'eww-mode))
+                               (not (eq bufn curbuf)))))))
+      (call-interactively #'eww))))
 
 (defun eww-toggle-fonts ()
   "Toggle whether to use monospaced or font-enabled layouts."
-- 
2.49.0

-- 
Manuel Giraud