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: Thomas Keller
Subject: Re: [Monotone-devel] Please review nvm.man-page
Date: Thu, 19 Aug 2010 14:58:46 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Lightning/1.0b2pre Thunderbird/3.0.6

Am 19.08.2010 14:05, schrieb Stephen Leake:
> Thomas Keller <address@hidden> writes:
> 
>> Please have a final look at nvm.man-page. 
> 
> Compilation fails because 'isatty' is not defined in Windows MinGW.
> 
> Neither is troff or less, on a typical MinGW system.

Weird, we use isatty in win32/terminal.cc - could you test and see if
this fixes the issue for you?

#
# old_revision [64367890e4f081f62c6495359dc74ded12d33a13]
#
# patch "cmd.cc"
#  from [b0c21243f7f344006c05aebb2b4f5c9f9ee6ccfd]
#    to [581f15da8b3300ba057c6ed006dde65a84be679b]
#
============================================================
--- cmd.cc      b0c21243f7f344006c05aebb2b4f5c9f9ee6ccfd
+++ cmd.cc      581f15da8b3300ba057c6ed006dde65a84be679b
@@ -24,6 +24,7 @@
 #ifndef _WIN32
 #include <signal.h>
 #include <errno.h>
+#include <io.h>
 #endif

 #include <iostream>


> Another solution is to dump a plain text version of the man page by
> default, and the formatted version when a new option --formatted is
> given; the Makefile will use the option. We could reuse the existing
> option --non-interactive for this.

The reason why the "manpage" command is not hidden and has this
interactivity functionality at all is that you cannot create localized
man pages on build time, since you cannot enforce which message
catalogue should be used unless the application is installed. So I
thought it might be a good idea to install the plain text english one
(available via `man mtn`) and have the localized one when `mtn manpage`
is called.

> At the very least, there needs to be an option to override the default
> interactive behavior, so we can generate the troff source from a command
> line (for including user commands, for example).

User commands are already included, as they're part of the overall
command tree. This is btw. another reason for `mtn manpage` which is
told to ignore any user commands specifically on build time via --norc
since they are of course only locally available and subject to change.
Using the command from scripts is also not a problem because as soon as
STDOUT is not a tty, the plain troff output is echoed anyways, so I see
no reason why there should be an option for that.

> If people don't have privs to install the man page, they can view it
> this way:
> 
> mtn man > mtn.1; MANPAGE=.:$MANPAGE man mtn
> 
> This could go in the manual.

This and the originally anticipated `mtn man | nroff -man -Tutf8 | less
-R` is a bit cumbersome and exactly the reason why I build this
interactivity into the command at all. I was kind of inspired of what
happens when you e.g. call `git add --help`.

> I tried various combinations of 'mtn man | troff | less'; none seemed to
> work well, I didn't spend much time trying to figure out why.

See the above command - this is also the default one which is configured
by the hook. If this doesn't work on mingw, we might want to find a
different call path and distinguish them in the hook.

> For MinGW testing, I commented out the isatty check, so it always dumps
> the troff source. The tests/manpage test passes.
> 
> Reading the output with 'man mtn' in a Cygwin bash shell works, and with
> 'M-x man mtn' in Emacs.
> 
> Building on Cygwin with unpatched code works, and running 'mtn man' in a
> Cygwin bash window works.

Good.

> However, the Cygwin mtn doesn't think bash running under MinGW Emacs is
> a tty, so it dumps the raw troff source there. 'man mtn' in bash under
> Emacs does a much better job; 'M-x man mtn' does an even better job. 

I don't know much of emacs, if you have a solution for this let me know.
I decided against using our own have_smart_terminal() function mainly
because this would also return true just for the case the TERM
environment variable is set. I don't know if its ok to trust on that for
this kind of interactivity.

Thanks for the comments!
Thomas.

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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