Subject: Re: bug#68254: EWW ‘readable’ by default

From: Eli Zaretskii <[email-masked]>
Date: Thu, 21 Mar 2024 12:51:21 +0200

> Date: Mon, 18 Mar 2024 17:00:33 -0700
> Cc: [email-masked], [email-masked]
> From: Jim Porter <[email-masked]>
> 
> Thanks for looking. I've addressed all of your comments, and made some 
> more extensive changes to the implementation. I split up some of the 
> logic in the first patch so that it's easier to reuse without error, and 
> then added 'eww-readable-urls' in the second.

Thanks, I have some minor nits below.

> Because of how much I changed, I'd like to add some regression tests to 
> make sure everything still works correctly, but otherwise these patches 
> should be ready to go.

Yes, tests would be good.

> ++++
> +*** 'eww-readable' now toggles display of the readable parts of a web page.
> +When called interactively, 'eww-readable' toggles whether to display
> +only the readable parts of a page or the full page.  With a positive
> +prefix argument, always display the readable parts, and with a zero or
> +negative prefix, always display the full page.

You say "toggles", but then "display".  It is better to make the style
consistent.

> +(defun eww--parse-html-region (start end &optional encode)
> +  "Parse the HTML between START and END, returning the DOM as an S-expression.
> +Use ENCODE to decode the region; if nil, decode as UTF-8.

It is better to call the argument DECODE, not ENCODE.

> +@vindex eww-readable-urls
> +  If you want EWW to render a certain page in ``readable'' mode by
> +default, you can add a regular expression matching its URL to
> +@code{eww-readable-urls}.  Each entry can either be a regular expression
> +as a string or a cons cell of the form @code{(@var{regexp}
> +. @var{readability})}. If @var{readability} is non-@code{nil}, this
                        ^^
Please use @w to prevent breaking long expressions between two lines.
Also, please leave two spaces between sentences.

> +(defcustom eww-readable-urls nil
> +  "A list of regexps matching URLs to display in readable mode by default.
> +Each element can be either a string regexp or a cons cell of the
> +form (REGEXP . READABILITY).  If READABILITY is non-nil, this behaves
> +the same as the string form; otherwise, URLs matching REGEXP will never
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
What do you mean by "the same as the string form"? which string form?