From: Dragan Simic Date: Thu, 23 May 2024 14:18:03 GMT Subject: Re: [PATCH 5/5] add-patch: render hunks through the pager Message-ID: <261636d461e58ac8a16180c4cd6e0460@manjaro.org> In-Reply-To: On 2024-05-23 16:00, Junio C Hamano wrote: > Jeff King writes: > >> I do still think it >> would be useful to be able to configure its pager separately (in my >> case, I'd use "less -FX" rather than my default setup, which doesn't >> use >> either of those options). > > Even better. Allow to optionally have the command after the option, > e.g., > > (1/1) Use this hunk [y,n,q,j,k,e,p,P] P > (1/1) Use this hunk [y,n,q,j,k,e,p,P] Pless -FX > (1/1) Use this hunk [y,n,q,j,k,e,p,P] Pcat Please note that "-X" will no longer be used as one of the options passed to less(1) as the pager, in the upcoming resolution of the age-old pager issues. [1] In more detail, "-X" is actually an ugly hack that was nothing more than a stopgap measure, but it has never been resolved properly. That is, until recently, when I started to collaborate with the author of less(1) towards finding and implementing the real solution. [1] https://lore.kernel.org/git/8289ef15266172cbfa10bb146afe9797@manjaro.org/T/#u > The first one feeds the default program with the hunk via pipe, the > second one instead invokes command you specifed, "less -FX", and > feeds the hunk to it via a pipe. The last one emulates a plain 'p' > behaviour. Frankly, that would be a lot of typing, and may even open a path for some unforeseen security issues. > And for usability, perhaps giving a specific command would change > the default program a bare 'P' invokes for the rest of the session > until another specific command overrides. Another usability hack > may be "[interactive] pipecommand = less -FX" configuration variable > gives the initial default for each session. I think that would be way too complicated. > At that point, we can explain it as > > p - print the current hunk > P[] - pipe the current hunk to a program > > or even use '|' instead of 'P'.