monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Please review nvm.man-page


From: Stephen Leake
Subject: Re: [Monotone-devel] Please review nvm.man-page
Date: Tue, 24 Aug 2010 04:32:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt)

Thomas Keller <address@hidden> writes:

> Am 23.08.2010 13:37, schrieb Stephen Leake:
>> Thomas Moschny <address@hidden> writes:
>>
>>> Stephen Leake <address@hidden>:
>>>> This almost works (from bash under Emacs), but it loses all the
>>>> headers:
>>>>
>>>> function get_man_page_formatter_command()
>>>>    local term_width = guess_terminal_width() - 2
>>>>    local path = "c:/bin"
>>>>    -- On MinGW, 'popen' runs 'cmd.exe' with the inherited path; run
>>>> Cygwin bash from there return string.format("bash -c nroff -man
>>>> -rLL=%dn | less -R", term_width) end
>>>
>>> Problem is that you need to pass exactly one argument to the -c option,
>>> so quoting is to be used:
>>>
>>> return string.format(
>>>   "bash -c 'nroff -man -rLL=%dn' | less -R", term_width)
>>>
>>> works, at least under Linux. Otherwise, the -man and -r options are
>>> consumed by bash, not nroff.
>>
>> Yes, that works; same result as running 'man' under Emacs.
>>
>> Should we put a note about this in the manual, or an example monotonerc
>> in contrib?
>
> Better hack the hook directly. You can use the return value of
> get_ostype() for Unix/Windows distinction.

No, because it requires that Cygwin also be installed, which is not easy
to test, and is probably not typical.

To summarize; the workaround above is needed to make 'mtn manpage
--formatted' work on MinGW, but relies on Cygwin providing sh, nroff,
and less.

Hmm. Maybe it's not so bad. If we did use the above workaround when
get_ostype returns Windows, but Cygwin was not installed, it would
report 'bash not found', instead of 'nroff not found'. Either way, it
gives the user a clue that they need to install more stuff; they might
then go read the manual to find out what.

While if they happen to have Cygwin installed (and in PATH), it would
Just Work.

If they happen to have some other toolset that provides sh, nroff, and
less, that would also Just Work.

Since the Cygwin version of mtn is required for ssh: and file: on
Windows, it may be that most MinGW mtn users will have Cygwin installed.
We need a reliable poll :).

In summary, I agree we should provide a hook that Just Works for MinGW +
Cygwin (or some other toolset), but fails cleanly for pure MinGW.

> And we might want to try out if a generic "sh -c '....'" works on all
> platforms without further hacking...

This works for MinGW + Cygwin.

Have you tried it for Mac?

I think it's best to only use 'sh -c' when necessary, just in case
there's a weird sh floating around out there.

Committed on nvm.man-page and nvm (didn't notice you had merged to
main).

--
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]