[darcs-users] proposal for whitespace annotation in darcs what

Michael G Schwern schwern at pobox.com
Tue Mar 29 22:14:02 UTC 2005


On Tue, Mar 29, 2005 at 07:47:03PM +0200, Stefan Rank wrote:
> Is there an easy way of making the shell itself do that outside of darcs?
>
> The tabs option can possibly be worked around using unix pipes, I do not
> think thats doable for changed line endings.

Unix pipes do not muck with newlines or any other character (thank god) so
this is doable with piping.  In fact, that's probably what you want to do
rather than lump it into darcs.  And since you're probably already viewing
"darcs whatsnew" through a pager anyway...

less -U

       -U or --UNDERLINE-SPECIAL
              Causes backspaces, tabs and carriage returns to  be  treated  as
              control  characters;  that  is, they are handled as specified by
              the -r option.

       -r or --raw-control-chars
              Causes "raw" control characters to be displayed.  The default is
              to  display  control  characters  using  the caret notation; for
              example, a control-A (octal 001) is displayed as "^A".

For example.

0 ~$ perl -wle 'print "\tfoo\r\n"' | less -U
^Ifoo^M

Not the prettiest format in the universe, but there it is.

Here's a little program to do a prettier format.  I've added the feature 
where it translates trailing newlines into underscores.

$ perl -we 'print "\t\tfoo  bar \b  \r\n"' | ~/bin/show
< tab >< tab >foo  bar < bs >__< cr >

http://www.pobox.com/~schwern/bin/show





More information about the darcs-users mailing list