[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#68254: EWW ‘readable’ by default
From: |
Jim Porter |
Subject: |
bug#68254: EWW ‘readable’ by default |
Date: |
Sun, 17 Mar 2024 22:44:05 -0700 |
On 3/17/2024 10:17 PM, Navajeeth via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
Thank you so much for the patch, @Jim! I dunno how to apply patches, but
I’ll learn and try yours out as soon as I can.
Even though I contribute to Emacs, I tend to use the latest proper
release as my daily editor (so I'm using 29.2 now).[1] If I want to use
a patch I wrote on an older release, I take the new version of all the
relevant functions and then override the old ones using 'advice-add':
(defun updated-eww-readable (&optional arg)
;; new implementation here
)
(advice-add 'eww-readable :override 'updated-eww-readable)
If the patch has merged to the master branch, I usually wrap that with
'(when (< emacs-major-version 30) ...)' so that it doesn't do anything
on the master builds, and also so I know to remove it when 30.1 comes
out and I prune my init.el.
I think a better way to go would be to have a /readability-off/ list for
the readability-minor-mode. In my experience, with the kind of sites I
open with EWW (textual sites without a lot of graphics or JavaScript),
the list of ones where ‘eww-readable’ doesn’t work is a lot smaller than
the ones where it does.
I was thinking about doing something like this. The list of regexps
could include a way to say both "if this regexp matches, use readable
mode" and "if this regexp matches, *don't* use readable mode". Then you
could make the list look something like this:
'(("^https://example.com/" . not-readable)
".*")
That would make every page except those from https://example.com use
readable mode. I think that would be the most flexible for complex
cases, while still being simple for the common case (a list of "plain"
regexps for readable-mode pages). It would also make it easy to have
most of a site (except for one section) use readable-mode.
[1] Mainly I just want to avoid having to worry about updating Emacs
master and then ending up with a broken Emacs. Murphy's Law dictates
that that will always occur at the worst possible time.