Subject: bug#34374: 27.0.50; Outside an eww buffer, optionally use new buffer when calling eww instead of reusing *eww*

From: Eli Zaretskii <[email-masked]>
Date: Fri, 08 Feb 2019 08:52:28 +0200

> From: Göktuğ Kayaalp <[email-masked]>
> Date: Fri, 08 Feb 2019 00:19:36 +0300
> 
> Eww should support conveniently avoiding using the same buffer even when
> not in an eww buffer (M-x eww or browse-url).  Currently, in an eww
> buffer, ‘eww-open-in-new-buffer’ opens the link under point in a new
> buffer, and ‘eww’ reuses the buffer.  When running ‘eww’ outside an eww
> buffer, it reuses the ‘*eww*’ buffer.  Attached is a patch where by
> default this behaviour is retained, but when a new custom,
> ‘eww-reuse-buffer’ is truthy (defaults to nil), Eww uses a new buffer
> (obtained via ‘generate-new-buffer’) instead, unless the current buffer
> is an eww buffer.  The navigation behaviour in eww buffers is retained.

Wouldn't it be more convenient if you could invoke eww with a prefix
argument for that?

> I have manually tested the general use of EWW with this patch applied.
> But I haven’t found a test suite for EWW; if I missed it, I can run it,
> or any other suggested testing.

You could start a test suite, although testing eww should ideally work
even if no network connection is available.

> Subject: [PATCH] Support not reusing *eww* buffer when navigating from a
>  non-eww one

It is best to reword this header line to be positive instead of
negative.

> +(defcustom eww-reuse-buffer t
> +  "Reuse the *eww* buffer when not in an `eww-mode' buffer."

For a boolean option, the first line of the doc string should say
either

  Non-nil means reuse the *eww* buffer ...

or

  Whether to reuse the *eww* buffer ...

(the former is preferable).

> +When the current buffer is not in `eww-mode', if
> +`eww-reuse-buffer' is non-nil, the *eww* buffer will be reused if
> +available, otherwise generated; if set to nil instead, a new
> +buffer will be used in case *eww* is already in use."

Once this feature exists and is used, wouldn't it be better to program
it so it either reuses the current EWW buffer or creates a new one,
regardless of whether the current buffer's name is "*eww*"?  IOW,
should we really hardcode "*eww*" in this feature?

> -     (get-buffer-create "*eww*")))
> +     (funcall
> +      (if eww-reuse-buffer #'get-buffer-create #'generate-new-buffer)
> +      "*eww*")))

Any particular reason to use funcall here, instead of calling the
functions literally?

Thanks.