Subject: bug#50497: [PATCH] Adding eww-{next,previous,up,top}-path.

From: Juri Linkov <[email-masked]>
Date: Fri, 10 Sep 2021 09:43:09 +0300

> I often find myself wanting to navigate paginated web pages
> (e.g. <https://media.libreplanet.org/videos?page=4>), or to go up or all
> the way up when visiting a web page, which is why I added these functions
> to my eww.
>
> Does this change make sense?

This reminds a very useful Firefox add-on "Go Up" that lets you go up
a level to the parent directory on the current website by pressing
Alt+UpArrow, and some other add-ons I don't remember their names.

> +    (define-key map "N" 'eww-next-path)
> +    (define-key map "P" 'eww-previous-path)
> +    (define-key map "U" 'eww-up-path)
> +    (define-key map "T" 'eww-top-path)

Would it be possible to combine this feature with the existing

    (define-key map "n" 'eww-next-url)
    (define-key map "p" 'eww-previous-url)
    (define-key map "u" 'eww-up-url)
    (define-key map "t" 'eww-top-url)

that rely on special attributes.  I mean to install your new commands.
Then later add fallbacks to both sets of commands: if there is
no special attribute, then "n"/"p"/"u"/"t" could try to deduce the
page from URL by calling your new commands, instead of signaling
an error as they do currently by (user-error "No `next' on this page").
And vice versa: if your commands don't match a number in the URL, then
fall back to "n"/"p"/"u"/"t", maybe optionally.