teco

Check-in [ca19f6dbdb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Handle email quotes in fill (mf). Update mh reply (mi) support.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:ca19f6dbdb929f253ddc940e7c81657a10a9a553c26304ecc3fa283da549fc47
User & Date: ajv-899-334-8894@vsta.org 2013-12-22 19:50:57
Context
2013-12-22
19:54
Protect against stale tecorc generation check-in: 20e7dd6a97 user: ajv-899-334-8894@vsta.org tags: master, trunk
19:50
Handle email quotes in fill (mf). Update mh reply (mi) support. check-in: ca19f6dbdb user: ajv-899-334-8894@vsta.org tags: master, trunk
19:49
Remove a stale debug output check-in: 0895f3da25 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/fill.tec.

1
2
3
4
5

6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21


22

23
24
25

26
27
28
29
30
31
32
33
34
35
36
37

38
39
40


41
42
43
44
45

46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64
65
66






67
68
69
70
71
72
73
74









75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

99
100

101
102
103
104
105
106
107
108
109
110
111







112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
!* mf--Fill paragraph point lies within, written all in TECO !
!* Optional arg is line length, default is 70 !
!* Textual Q regs: !
!*  t - current word being filled into output !
!*  u - list of space chars !

!* Number Q regs: !
!*  a - current position in input !
!*  b - end position of input !
!*  c - current output column !

!*  p - current output position !
!*  s - position of start of input !
@^uf\
+0ua
qa"e 70um | qaum '

!* Save text registers we scribble on !
[t[u

!* Decimal !
^D



!* Move to beginning of paragraph !


!* Move to first line which doesn't start with text !
<

 !* Move to start of line !
 0l

 !* Leave loop when line doesn't start with alphanum !
 ::@s/R/;

 !* Back up another line !
 -l

 !* Exit at start of buffer !
 ."e 1;'
>


!* Don't include line unless it's just leading white space !
."g


 0l::@s/S/"u 1l'
'
0l

!* Record position in QAn, also QSn so can delete when done !

.ua
qaus

!* Move to end of paragraph !
<
 !* Move to start of line !
 0l

 !* Leave loop when line doesn't start with alphanum !

 ::@s/R/;

 !* Forward a line !
 l
>

!* End position in QBn !
.ub

!* Avoid zero-length operations !
qa-qb"e Empty paragraph specified
 ^c'







!* Build the filled text right below the unfilled text, jumping back !
!* and forth !

!* QPn is our current output position !
qbup
!* QCn is our current output column !
0uc










!* Honor leading white space !
qaj
<
 ::@s/S/;
 1r
 ::@s/	/"s 8%c | 1%c 1c '
>
!* Copy white space into output, skip past it !
!* Move text via QT !
qa,.xt
.ua
qpj gt .up

!* Set QU to white space chars !
@^uu/ 	
/

!* While words, assemble and fill !
<
 !* Skip leading white space !
 qaj
 <::@s/gu/;>
 .ua


 !* Walk across word, pull into QT !

 <::@s/gu/"s 1r 1; | 1c'>
 qa,.xt
 .ua

 !* If we're past end of range we want, terminate loop !
 qa-qb;

 !* If it won't fit on the line, terminate current line and start over !
 qc+:qt+1-qm"g
  qpj @i/
/ 0uc .up







 '

 !* Add in our word, update column counter !
 qpj
 qc"g
  1r @::s/./"s @i/ / 1%c | 1c' !* Two spaces between sentences !
  @i/ / 1%c !* Space between words !
 '
 gt .up
 :qt%c
>

!* Chop off unfilled text, add trailing newline !
qpj
@i/
/
qs,qbk
qsj

!* Restore text registers we scribble on !
]u]t
\






>




>







|

<
<
<
>
>
|
>

<
<
>
|
|
|
|
|

|
<

<
<
<
>
|
<
<
>
>
|
|
<
<
<
>
|
<

<
<
<
<
<
<
>
|
|
<
|
<
<
<
<
<


|
>
>
>
>
>
>








>
>
>
>
>
>
>
>
>




|



|
<
|
<


<
<
<
<





|
>


>
|









|
>
>
>
>
>
>
>



<
<
<
<
<

|










|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20



21
22
23
24
25


26
27
28
29
30
31
32
33

34



35
36


37
38
39
40



41
42

43






44
45
46

47





48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83

84
85




86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116





117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
!* mf--Fill paragraph point lies within, written all in TECO !
!* Optional arg is line length, default is 70 !
!* Textual Q regs: !
!*  t - current word being filled into output !
!*  u - list of space chars !
!*  v - prefix text on each line !
!* Number Q regs: !
!*  a - current position in input !
!*  b - end position of input !
!*  c - current output column !
!*  d - flag first word in line !
!*  p - current output position !
!*  s - position of start of input !
@^uf\
+0ua
qa"e 70um | qaum '

!* Save text registers we scribble on !
[t[u[v[w




!* Leading quotation? !
0l ::@s/> /"s 0l
 !* Record prefix !
 @^uv/> /



 !* Identify paragraph to fill by presence of quotations !
 < ::@s/> /"u 1l 1; ' 0l ."e 1; ' -l > .ua
 < .-z"e 1; ' ::@s/> /; 1l > .ub
|
 !* No prefix !
 @^uv//

 !* Find paragraph by block of text, all starting with alnum !





 !* Find start of this paragraph !
 <


  ::@s/R/"u
   !* Failing line included if indented (leading spaces) !
   ::@s/S/"u 1l ' 1;
  '



  0l ."e 1; ' -1l
 > .ua








 !* Walk forward to line without alnum header !
 < l ::@s/R/; > .ub
'







!* Avoid zero-length operations !
qa-qb"e Empty paragraph specified
 ^c '

!* text to fill is in qa..qb !
!* qv has any prefix/quotation string !

!* Start of range in qs, so we can delete original text after fill !
qaus

!* Build the filled text right below the unfilled text, jumping back !
!* and forth !

!* QPn is our current output position !
qbup
!* QCn is our current output column !
0uc
!* Start of line--first word being added !
1ud
!* Set QU to white space chars , QW to white plus newline !
@^uu/ 	/
@^uw/ 	
/

!* Honor leading quote !
:qv%a  qpj gv .up :qvuc

!* Honor leading white space !
qaj
<
 ::@s/gu/;
 1r
 ::@s/	/"s 8%c | 1%c 1c '
>
!* Copy leading white space via qt !

qa,.xt .ua

qpj gt .up





!* While words, assemble and fill !
<
 !* Skip leading white space !
 qaj
 <::@s/gu/;>
 !* At new line, skip any quote !
 ::@s/^EL/"s 1l .-qb"l  :qvc ' '

 !* Walk across word, pull into QT !
 .ua
 <::@s/gw/"s 1r 1; | 1c '>
 qa,.xt
 .ua

 !* If we're past end of range we want, terminate loop !
 qa-qb;

 !* If it won't fit on the line, terminate current line and start over !
 qc+:qt+1-qm"g
  qpj @i/
/ gv :qvuc .up 1ud
 '

 !* Put space(s) between words !
 qpj qd"e
  1r @::s/./"s @i/ / 1%c | 1c ' !* Two spaces between sentences !
  @i/ / 1%c !* Space between words !
 | 0ud
 '

 !* Add in our word, update column counter !





 gt .up
 :qt%c 
>

!* Chop off unfilled text, add trailing newline !
qpj
@i/
/
qs,qbk
qsj

!* Restore text registers we scribble on !
]u]t]v]w
\


Changes to lib/repl.tec.

1

2
3
4
5
6
7
8
9
10



11
12
13

14

15
16

17



18
19
20
21
22
23
24

25
26
27


28
29
30
31


32
33
34
! mi--Interpolate reply from MH !

@i\
 [a
 ! Read in file !
 zj.ua
 :@er/@/"f
  Interpolation not possible
   ^C
 '
 a




 ! Trim headers off !
 qaj

 :@s/


/"s

  qa-.d



 '
 ! Put marker on each line of text !
 <i>l.-z;>
 ]a
 zj

 ! Move to head of text !

 -@s/
--------
/0l



 ! Insert white space for us to type into !
 @i/




/-2l
\
|
>

<
<
<
<
<
<
|
<
>
>
>

<
<
>
|
>

<
>
|
>
>
>
|
|
|
<
<

<
>
|
<
<
>
>
|
<
<

>
>

<

1
2
3






4

5
6
7
8


9
10
11
12

13
14
15
16
17
18
19
20


21

22
23


24
25
26


27
28
29
30

31
!* mi--Prep email reply made by MH !
!* qa - Beginning of message body !
@i\








!* Jump to body of message !
0j @s/
----/ 0l l .ua



!* Break up quoted blocks by blank lines !
< ::@s/> 
/"s .ub 0l -l qb-.-2d ' l .-z; >


!* (re)format each quoted block !
qaj [a
<
 !* Advance to next quoted block !
 < ::@s/> /"s 0l 1;' l .-z; >

 !* Format this paragraph !
  mf




 !* Advance to next blank line or EOF !
 < ::@s/


/ :; l .-z; >
 .-z;
>



!* Back up to top !
]a qaj


\