git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Should "git help" respect the 'pager' setting?
@ 2013-05-30 16:33 Michael Campbell
  2013-05-30 16:42 ` Matthieu Moy
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Campbell @ 2013-05-30 16:33 UTC (permalink / raw)
  To: git

I have my global git config pager set to 'cat', but when I do a "git
help <command>", it still uses a pager.  This is especially irksome in
emacs shell buffers, where I am most of the time.  I know I can do a
M-x man -> git-<whatever>, but wondered if this was a bug or user
error.  ("git --no-pager help <command>" does the same.)


12:31 [mcampbell] /tmp  % git --no-pager help log
WARNING: terminal is not fully functional
-  (press RETURN)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should "git help" respect the 'pager' setting?
  2013-05-30 16:33 Should "git help" respect the 'pager' setting? Michael Campbell
@ 2013-05-30 16:42 ` Matthieu Moy
  2013-05-30 16:56   ` Ramkumar Ramachandra
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Moy @ 2013-05-30 16:42 UTC (permalink / raw)
  To: Michael Campbell; +Cc: git

Michael Campbell <michael.campbell@gmail.com> writes:

> I have my global git config pager set to 'cat', but when I do a "git
> help <command>", it still uses a pager.  This is especially irksome in
> emacs shell buffers, where I am most of the time.  I know I can do a
> M-x man -> git-<whatever>, but wondered if this was a bug or user
> error.  ("git --no-pager help <command>" does the same.)

"git help foo" just calls "man git-foo" by default, so what happens is
the same as if you called "man git-foo" by hand. Git does not have
much control over what man will do, it could probably call "man -P
$pager" when the Git pager is set, but I'd find it a bit weird.

If you're an Emacs user, you can read about man.viewer and set it to
woman, or set PAGER=cat when inside Emacs.

I personally run M-x git-foo RET, and never run "git help".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should "git help" respect the 'pager' setting?
  2013-05-30 16:42 ` Matthieu Moy
@ 2013-05-30 16:56   ` Ramkumar Ramachandra
  2013-05-30 17:05     ` Matthieu Moy
  0 siblings, 1 reply; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-30 16:56 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Michael Campbell, git

Matthieu Moy wrote:
> Michael Campbell <michael.campbell@gmail.com> writes:
>> I have my global git config pager set to 'cat', but when I do a "git
>> help <command>", it still uses a pager.  This is especially irksome in
>> emacs shell buffers, where I am most of the time.  I know I can do a
>> M-x man -> git-<whatever>, but wondered if this was a bug or user
>> error.  ("git --no-pager help <command>" does the same.)
>
> "git help foo" just calls "man git-foo" by default, so what happens is
> the same as if you called "man git-foo" by hand. Git does not have
> much control over what man will do, it could probably call "man -P
> $pager" when the Git pager is set, but I'd find it a bit weird.

It just needs to set $PAGER or $MANPAGER before the exec(), no?  I
would argue that it should do this.  $GIT_PAGER works everywhere else,
but obviously man has no knowledge about it.

> If you're an Emacs user, you can read about man.viewer and set it to
> woman, or set PAGER=cat when inside Emacs.

I just learnt about man.viewer.  There's a small problem with it
though: why is there no option for Emacs man corresponding to Emacs
woman?

> I personally run M-x git-foo RET, and never run "git help".

M-x man git-foo RET, you mean?  My style is slightly different: I love
typing out 'man git log' on the terminal (dashless); I get it to open
in an Emacs buffer using this hack:

function man_ () {
	emacsclient -e "(man \"$*\")" 2>&1 >/dev/null || man "$*"
}

alias man=man_

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should "git help" respect the 'pager' setting?
  2013-05-30 16:56   ` Ramkumar Ramachandra
@ 2013-05-30 17:05     ` Matthieu Moy
  2013-05-30 17:08       ` Ramkumar Ramachandra
  0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Moy @ 2013-05-30 17:05 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Michael Campbell, git

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> It just needs to set $PAGER or $MANPAGER before the exec(), no?

Yes, that should do the same as "man -P".

> I would argue that it should do this. $GIT_PAGER works everywhere
> else, but obviously man has no knowledge about it.

I find it a bit weird that Git sets the configuration for external
commands, but it may make sense. No strong opinion here.

>> If you're an Emacs user, you can read about man.viewer and set it to
>> woman, or set PAGER=cat when inside Emacs.
>
> I just learnt about man.viewer.  There's a small problem with it
> though: why is there no option for Emacs man corresponding to Emacs
> woman?

I guess because no one implemented it ;-).

>> I personally run M-x git-foo RET, and never run "git help".
>
> M-x man git-foo RET, you mean?

Yes, sorry.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should "git help" respect the 'pager' setting?
  2013-05-30 17:05     ` Matthieu Moy
@ 2013-05-30 17:08       ` Ramkumar Ramachandra
  2013-05-30 17:14         ` John Keeping
  0 siblings, 1 reply; 7+ messages in thread
From: Ramkumar Ramachandra @ 2013-05-30 17:08 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Michael Campbell, git

Matthieu Moy wrote:
> I find it a bit weird that Git sets the configuration for external
> commands, but it may make sense. No strong opinion here.

I don't mean a setenv() kind of thing: how would we unset it after
that?  Perhaps something like execvpe(), passing in the environment as
an argument?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should "git help" respect the 'pager' setting?
  2013-05-30 17:08       ` Ramkumar Ramachandra
@ 2013-05-30 17:14         ` John Keeping
  2013-06-02 22:24           ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: John Keeping @ 2013-05-30 17:14 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Matthieu Moy, Michael Campbell, git

On Thu, May 30, 2013 at 10:38:59PM +0530, Ramkumar Ramachandra wrote:
> Matthieu Moy wrote:
> > I find it a bit weird that Git sets the configuration for external
> > commands, but it may make sense. No strong opinion here.
> 
> I don't mean a setenv() kind of thing: how would we unset it after
> that?  Perhaps something like execvpe(), passing in the environment as
> an argument?

Overriding PAGER might make sense, but I'd be quite annoyed if Git
decided to override MANPAGER without providing some way to override it.

If a user sets MANPAGER then it's because they want a specific pager
when reading man pages - invoking man through "git help" shouldn't cause
it to behave differently in this case.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should "git help" respect the 'pager' setting?
  2013-05-30 17:14         ` John Keeping
@ 2013-06-02 22:24           ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2013-06-02 22:24 UTC (permalink / raw)
  To: John Keeping; +Cc: Ramkumar Ramachandra, Matthieu Moy, Michael Campbell, git

John Keeping <john@keeping.me.uk> writes:

> On Thu, May 30, 2013 at 10:38:59PM +0530, Ramkumar Ramachandra wrote:
>> Matthieu Moy wrote:
>> > I find it a bit weird that Git sets the configuration for external
>> > commands, but it may make sense. No strong opinion here.
>> 
>> I don't mean a setenv() kind of thing: how would we unset it after
>> that?  Perhaps something like execvpe(), passing in the environment as
>> an argument?

Running "man" is the last thing we do before exitting "git help" and
exec_man_man() does seem to do execlp(), so I do not see it as an
issue.

> Overriding PAGER might make sense, but I'd be quite annoyed if Git
> decided to override MANPAGER without providing some way to override it.

Hmm, see below.

> If a user sets MANPAGER then it's because they want a specific pager
> when reading man pages - invoking man through "git help" shouldn't cause
> it to behave differently in this case.

True, and for that matter, if the user sets PAGER to use with
non-Git (including manual pages) and also sets GIT_PAGER to use
specifically with Git, the user would be annoyed if we passed
formatted manual pages to GIT_PAGER by exporting PAGER (or driving
"man" with its "-P" option).

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-02 22:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 16:33 Should "git help" respect the 'pager' setting? Michael Campbell
2013-05-30 16:42 ` Matthieu Moy
2013-05-30 16:56   ` Ramkumar Ramachandra
2013-05-30 17:05     ` Matthieu Moy
2013-05-30 17:08       ` Ramkumar Ramachandra
2013-05-30 17:14         ` John Keeping
2013-06-02 22:24           ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).