From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <29d74e36513be89fc1fdef0aa4c96dfb@cs.cmu.edu> To: 9fans@cse.psu.edu From: David Swasey MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] Minor change to pr(1) Date: Fri, 18 Apr 2003 14:07:13 -0400 Topicbox-Message-UUID: 92aaecac-eacb-11e9-9e20-41e7f4b1d025 Please consider changing pr -i to use a single space, rather than a tab, in the case where one space is needed just before a tab stop. For example, I would prefer that the output of echo 'donttab here' | pr -ti contains no tabs. One way to accomplish this is diff /n/dump/2003/0418/sys/src/cmd/pr.c /sys/src/cmd/pr.c 27c27 < #define ITABS (Itabn > 0 && Nspace >= (nc = Itabn - Outpos % Itabn)) --- > #define ITABS (Itabn > 0 && Nspace > 1 && Nspace >= (nc = Itabn - Outpos % Itabn)) In case you are curious, I will explain why I want this. I must often edit SML code that uses four space indents and eight space tabs. (I am forced to use this horrible indentation scheme.) My scripts to indent and unindent blocks of code use pr. For example, my ind4 is #!/bin/rc cat $* | pr -te | sed 's/^/ /' | pr -ti The problem with using this script on SML code is that SML does not allow tabs in string literals. The change to pr avoids this problem for strings that do not contain a run of spaces and makes the code look a little better with a proportional font. For example, if I pipe the code val x = "no tabs allowed" through ind4 I get val x = "no tabs allowed" with the stock pr and val x = "no tabs allowed" with a modified pr. The former is malformed SML. -dave