* On 20 Nov 2012, David Champion wrote: 
> * On 20 Nov 2012, Peter Davis wrote: 
> > Is there any reasonly easy (non-painful) way to put a table in a
> > message? A plain text table would be fine if I could limit it to 72
> > characters wide or so, and if there were a reasonable way to edit it,
> > preferably in emacs.
> 
> Type this:
> ...

I've never used this before but I want to start.  I wrote a wrapper so
that I only need to compose the table's contents, not the additional
markup.

### save to mutt-table script
#!/bin/sh
# "table wider than line width" is an error that tbl may produce when
# no terminal is present.
(
        echo '.TS'
        echo 'box tab(|);'
        read line
        # produce a column format based on columns in line 1
        echo "$line" | sed -e 's,[^|]*,l,' -e 's,[^|]*,c,g' -e 's,$,.,'
        echo "$line"
        cat -
        echo '.TE'
) |
tbl |
nroff -Tascii 2>&1 |
grep -v 'table wider than line width' |
uniq

### add to .exrc
map T {
!}mutt-table

### type into vi
Year|Hurricane|Deaths|Location
1780|Great Hurricane of 1780|27,500+|Antilles
1998|Hurricane Mitch|18,974 - 21,000|Honduras
1900|cane|8,000 - 12,000|Cuba, Texas
1974|Hurricane Fifi|8,000 - 10,000|Honduras, Belize
1930|bcane|2,000 - 8,000|Antilles, D.R.
1963|Hurricane Flora|7,186 - 8,000|Haiti, Cuba

### press T over table to format

-- 
David Champion • d...@uchicago.edu • IT Services • University of Chicago

Reply via email to