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

From: Yuchen Pei <[email-masked]>
Date: Fri, 10 Sep 2021 16:57:58 +1000

Juri Linkov <[email-masked]> writes:

>> 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").

This sounds good to me, if it does not break people's workflows.

> And vice versa: if your commands don't match a number in the 
> URL, then
> fall back to "n"/"p"/"u"/"t", maybe optionally.

I think the previous fallback should be sufficient, and I feel a 
"mutual" fallback like this could be confusing.

-- 
Best,
Yuchen

PGP Key: 47F9 D050 1E11 8879 9040  4941 2126 7E93 EF86 DFD0
           <https://ypei.me/assets/ypei-pubkey.txt>