unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51613: Eww buffer creation
@ 2021-11-05 15:46 André A. Gomes
  2021-11-05 23:17 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: André A. Gomes @ 2021-11-05 15:46 UTC (permalink / raw)
  To: 51613

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

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"

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-creation-of-eww-buffers.patch --]
[-- Type: text/x-patch, Size: 1066 bytes --]

From dd07c5b564effc5efd0ca2b1581694e32f5b9f14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20A=2E=20Gomes?= <andremegafone@gmail.com>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#51613: Eww buffer creation
  2021-11-05 15:46 bug#51613: Eww buffer creation André A. Gomes
@ 2021-11-05 23:17 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-05 23:17 UTC (permalink / raw)
  To: André A. Gomes; +Cc: 51613

André A. Gomes <andremegafone@gmail.com> writes:

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

[...]

> +   (if (and (eq major-mode 'eww-mode) (null arg))
> +       (current-buffer)
> +     (generate-new-buffer "*eww*")))

I don't think that's correct?  Then `M-x eww' in a different buffer will
generate a new name.

So I've now fixed this in a different way in Emacs 29 (and renamed the
arguments to be more sensible).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-05 23:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 15:46 bug#51613: Eww buffer creation André A. Gomes
2021-11-05 23:17 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).