From maechler at stat.math.ethz.ch  Sat Apr 26 22:28:42 2014
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 26 Apr 2014 22:28:42 +0200
Subject: [Rd] Can the output of Sys.getenv() be improved?
In-Reply-To: <E66794E69CFDE04D9A70842786030B933FACA474@PA-MBX01.na.tibco.com>
References: <8EE4E2C595735A4EAEC2A3311537FE4D15B84B24@DCPWPEXMBX03.mdanderson.edu>
	<E66794E69CFDE04D9A70842786030B933FAC7207@PA-MBX01.na.tibco.com>
	<21330.29344.628971.904268@stat.math.ethz.ch>
	<E66794E69CFDE04D9A70842786030B933FACA474@PA-MBX01.na.tibco.com>
Message-ID: <21340.5882.843346.677435@stat.math.ethz.ch>

> >     >> structure(Sys.getenv(), class="simple.list")
> >     >                            _ !
> > 
> > Good idea; this is something we could do unconditionally, i.e.,
> > return from Sys.getenv().

> As the OP noted, the print method for simple.list will pad all
> lines to have the same length, so if, say, PATH, is very long,
> all other printed lines will be padded with blanks to match its
> length.  With the Windows GUI you don't notice this much
> because the lines do not wrap around, but when viewing results
> on Linux with a terminal emulator like putty this looks bad.  A print method like
>    p <- function(x, ...)
>    {
>       cat(formatDL(x), sep="\n")
>       invisible(x)
>    }
> would look better.

You are right, thank you, Bill, for the suggestion.
Indeed, as we have got the nice formatDL() formatting
functionality, why not providing yet another simple listlike
class, where I've use  "DList" (Description List) as indirectly
suggested by the DL of formatDL().

Committed as rev 65504 (R-devel only).

If there is a compelling argument for a better S3 class name, we
can still change that (longer names are not compelling to me,
much shorter ones neither ...)

Martin


> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com


> > -----Original Message-----
> > From: Martin Maechler [mailto:maechler at stat.math.ethz.ch]
> > Sent: Saturday, April 19, 2014 5:57 AM
> > To: William Dunlap
> > Cc: Jun Zhang; r-devel at r-project.org
> > Subject: Re: [Rd] Can the output of Sys.getenv() be improved?
> > 
> > >>>>> William Dunlap <wdunlap at tibco.com>
> > >>>>>     on Fri, 18 Apr 2014 16:50:22 +0000 writes:
> > 
> >     >> Within an R session, type Sys.getenv() will list all the
> >     >> environment variables, but each one of them occupies
> >     >> about a page, so scrolling to find one is difficult. Is
> >     >> this because I don't know how to use it or something
> >     >> could be improved?
> > 
> >     > Attaching the class "simple.list" to the output of
> >     > Sys.getenv() gives it a nicer print method:
> > 
> >     >> structure(Sys.getenv(), class="simple.list")
> >     >                            _ !
> > 
> > Good idea; this is something we could do unconditionally, i.e.,
> > return from Sys.getenv().
> > It would hardly break code,
> > as simple.list only has a print and a `[` method.
> > 
> > It would help people like Jun and could hardly harm, AFAICS.
> > 
> > Opinions?



[Rd] Can the output of Sys.getenv() be improved?
Martin Maechler