Subject: Eww buffer creation

From: André A. Gomes <[email-masked]>
Date: Fri, 05 Nov 2021 18:46:04 +0300

Hi Emacs,

I noticed that in order to open url-foo in a new buffer, I'd need to
call `(eww "url-foo" 4)`.  I understand that 4 is the universal
argument, but it looks cryptic (unless used interactively).  

Find my suggestion attached.  I took the opportunity to simplify the
underlying logic.

-- 
André A. Gomes
"Free Thought, Free World"
>From dd07c5b564effc5efd0ca2b1581694e32f5b9f14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20A=2E=20Gomes?= <[email-masked]>
Date: Fri, 5 Nov 2021 18:36:07 +0300
Subject: [PATCH] Fix creation of eww buffers.

---
 lisp/net/eww.el | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 74d3788116..3397b253e1 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -364,13 +364,9 @@ killed after rendering."
            (prefix-numeric-value current-prefix-arg))))
   (setq url (eww--dwim-expand-url url))
   (pop-to-buffer-same-window
-   (cond
-    ((eq arg 4)
-     (generate-new-buffer "*eww*"))
-    ((eq major-mode 'eww-mode)
-     (current-buffer))
-    (t
-     (get-buffer-create "*eww*"))))
+   (if (and (eq major-mode 'eww-mode) (null arg))
+       (current-buffer)
+     (generate-new-buffer "*eww*")))
   (eww-setup-buffer)
   ;; Check whether the domain only uses "Highly Restricted" Unicode
   ;; IDNA characters.  If not, transform to punycode to indicate that
-- 
2.33.1