-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect $PAGER environment variable #163
Conversation
Before, jiten would override $PAGER with `less' unless the user explicitly set it through -p, which is inconvenient if the user's $PAGER is not `less'. We still add the -FR flag if $PAGER is set to the string "less", so the behavior does not change for `less' users.
Thanks! I agree simply overwriting I'll have to think about it for a bit. Would being able to set e.g. |
Good point. I think there's no perfect solution here, only trade-offs :/ My idealistic self would say "PAGER is meant to be used as-is", but practicality is more important than purism... hence the proposed (admittedly imperfect) heuristics. My thinking behind these is:
Failure modes:
Overall, this still looks like much better UX than requiring users to set a non-standard env var or a CLI flag, but I'm also biased by not using P.S. I've just realized: with the patch applied, |
I'll need to think about this a bit more. There's several interacting factors making this complicated.
As you said, "there's no perfect solution here, only trade-offs". And different users may have different expectations of what "the right thing to do" is here. So I want to take some time to try to find the best trade-off. |
-F seems -R is a bit more problematic, in particular when it comes to Other pagers I've tested all display colors by default, so no equivalent flag is needed.
Yeah, that's unfortunate :/ I guess an upstream patch will be needed to add a list of color-capable pagers other than A (Now I dream of a standard
Sounds reasonable. An alternative would be a config file, but that's kind of excessive for just two options :P |
Thanks for confirming stuff about other pagers. Only thing I'm not sure about is how best to balance backwards-compatibility with "doing the right thing" (I agree it should do its best to respect |
Well, that just depends on whether you see ignoring In my view, it's a bug: I do see that the Click coloring issue makes doing this right now a bit problematic ("ok, you get your PAGER, but no more colors!" :P), I will submit a patch to upstream to fix this. |
I think we agree. I meant "doing the right thing" = respect But indeed if we do that, some users might lose colours or otherwise get behaviour that would now be correct but result in changes in functionality for them. And that is something I only want to do if it's worth it. But I'm not sure how to weigh those options against each other since I have no information on how many users would be affected and, if so, how. If not for existing users that may (unknowingly) be relying on the incorrect behaviour we would not be having a discussion here :) |
Sadly, I made the mistake of not respecting |
I agree with your points. I am happy to report that I have found a better way to integrate Jiten with my pager in the meantime, so I am no longer affected by this issue. Accordingly, I will be closing this ticket. Thank you for your consideration, and sorry for bothering you. |
I am happy to hear that :)
Not at all. Thank you for bringing the issue to my attention and providing various details and insight. I'm still unsure what the best fix is, but I do think some improvement can be made here. I'm glad you found a solution that works for you and are thus not affected by the time it will take me to figure that out. |
Hi, thanks for writing this program, it's very useful.
This is a short patch I have used for a while to keep default
$PAGER
values even without the -p flag.Normally, jiten would override it with
less
unless the user explicitly set the pager through -p. But I use a more capable pager than less, and having to set the pager for every jiten call is inconvenient.Originally, I just ignored the "less -FR" default when
$PAGER
was set. But this is problematic from a backward-compatibility perspective: currently, the "-FR" options are added even if the user's$PAGER
equals "less", as it is by default on many operating systems. On such systems you would suddenly get theless
UI for single-page entries too, even though it just dumped those to standard out before.So I made it set "less -FR" if
$PAGER
is missing or equals the string "less", which should be compatible with the old behavior.