Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'How to extend Smultron using Commands' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to extend Smultron using Commands
Authored by: broomdodger on Jun 16, '07 06:33:32PM

par seems to truncate lines longer than 512 characters.
Is there a way around this limitation?



[ Reply to This | # ]
How to extend Smultron using Commands
Authored by: gshenaut on Jun 17, '07 06:40:59AM
I tested for this by running these two commands:
(ls /usr/bin | tr '\n' ' ' ; echo) | wc
(ls /usr/bin | tr '\n' ' ' ; echo) | par | wc
The wc(1) command writes out the number of lines, words, and characters in a stream. On my system, the output of the first command, without par, was "1 753 5754", indidcating 1 line, 753 words, and 5,754 characters (all of which were on a single line). The second command, with par, produced "84 753 5753", indicating that the single line of 5,754 chars was wrapped to produce 84 lines.

Perhaps there is some other reason that your lines are being truncated?

By the way, par will complain about words that are longer than the max line width, since it doesn't break words. Could that be what you are seeing?

[ Reply to This | # ]

How to extend Smultron using Commands
Authored by: broomdodger on Jun 17, '07 07:50:59AM

I installed par, added the environmental variable to .profile

PARINIT='rTbgqR B=.,?_A_a Q=_s>| P=.'

opened Smultron, added the commands

#!/bin/ksh
par w79 < %%s

and

#!/bin/ksh
par w9999 < %%s

selected a paragraph, used the par w79 command, and the paragraph was nicely wrapped, but truncated at 511 chars.

Could it be a Smultron problem?
Have you tried it with a long line in Smultron?



[ Reply to This | # ]
How to extend Smultron using Commands
Authored by: gshenaut on Jun 17, '07 05:57:25PM

Yes, I have tried it with long lines in smultron. Just to be sure, I re-did the "ls /usr/bin" test, but I saved the 5,753-character line in a file and edited it in smultron. Then I ran my "par w99" script and saved the result. It was fine, 76 wrapped lines, 5,753 characters.

Are you using smultron 3.1 ? Maybe that's what's going on.

Par probably isn't the ideal filter for this. You might try fmt(1), for example. I prefer par because like vi, it can be told about lines beginning with dot, like .PP as in the *roff formatters. In fact, a simple, special-purpose filter would be better than either one.



[ Reply to This | # ]
How to extend Smultron using Commands
Authored by: broomdodger on Jun 17, '07 09:03:08PM
Are you using smultron 3.1 ? Maybe that's what's going on.
Yes, version 3.1 MacOS 10.4.9 PPC
Should I try a different version?

[ Reply to This | # ]
How to extend Smultron using Commands
Authored by: broomdodger on Jun 17, '07 09:27:11PM
Are you using Smultron 3.1 ? Maybe that's what's going on.
I just now tried Smultron 2.2.7 and it gives "Invalid parameter" for the "<"

[ Reply to This | # ]
How to extend Smultron using Commands
Authored by: gshenaut on Jun 18, '07 08:35:01AM

No, an earlier version wouldn't help. The ability to filter selected text was new in 3.0, and 3.1 fixed various issues, so I was just thinking that you may have been using 3.0 and that this was a bug in that version.

How about the version of par ? I seem to have version 1.52, installed via darwinports. (You can check yours by the command "par version".)

In any case, you should compare the results of running the par command with the same input text both within smultron and from the command line, to see if you get truncated text both times. If you do, then it's undoubtedly a par problem; if you get it only within smultron, it's a smultron problem; and if you get it only on the command line, then I'd have no idea what's going on.

Greg



[ Reply to This | # ]
How to extend Smultron using Commands
Authored by: broomdodger on Jun 18, '07 08:12:03PM
How about the version of par ? I seem to have version 1.52, installed via darwinports. (You can check yours by the command "par version".)
I also have par 1.52 vial darwinports.

Right now I am more interested in using par with TextExtras inside TextEdit.
I am new to unix scripting but not programming, and do not know the syntax.

Have you tried that?

[ Reply to This | # ]