My scenario is the following: When I ask the psql program for \help, it pipes its output to less. Sometimes, I would like to keep the help contents while writing my next query. I imagine this could happen if I could tell less to write to stdout, like more would do, while in interactive mode.
I will decide whether or not this should happen AFTER I have seen the contents of \help. So, customizing the pager used by psql is (I think) not an option. This means that my question is not a duplicate of:
What I am currently using:
\setenv PAGER more OR \setenv PAGER 'less -X' \help alter user q (to exit less or more) -- Now I can write my query while looking at the alter user syntax above
What is lacking in this approach is that I would like to choose whether I want the -X option or not AFTER I have looked at the contents. I can imagine that less can achieve that by writing to both the main and the alternate buffer.