cvtmail.emacs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. !~Filename~:! !For dealing with PSL bug reports.!
  2. CVTMAIL
  3. !Cut Header:! !C Removes unwanted fields from a mail header.
  4. One must already be positioned at the start of a mail header.
  5. Cursor is left at the beginning of the next mail header.!
  6. [1 [2
  7. k
  8. .u1
  9. -l .,.+9:fb------- !* Kill preceding mail trailer, if any!
  10. "L -l ki
  11. '"# q1j'
  12. MM&_Fix_Mail-From
  13. l !* Skip initial date line!
  14. !loop! !* Kill uninteresting header lines!
  15. .u1 l .-q1-2"E Odone'
  16. q1j
  17. .,.+6:fbFrom:_ "LOmatch'
  18. .,.+9:fbSubject:_ "LOmatch'
  19. .,.+7:fbClass:_ "LOmatch'
  20. k Oloop
  21. !match!
  22. l Oloop
  23. !done!
  24. MM^R_Set/Pop_Mark
  25. <MM&_Header? !* Find a mail header line!
  26. q0"E l'"# 1;' !* Exit loop if found!
  27. >
  28. -l
  29. 2MM^R_Indent_Rigidly !* Indent the body of the message!
  30. l
  31. 
  32. !& Header?:! !C -1 if current line is header line else 0.!
  33. .u0 0l
  34. z-.-24 :"G Onomatch'
  35. 3a-- "N Onomatch'
  36. 7a-- "N Onomatch'
  37. 13a-: "N Onomatch'
  38. 16a-: "N Onomatch'
  39. 19a-- "N Onomatch'
  40. 23a-, "N Onomatch'
  41. q0j
  42. -1u0
  43. 
  44. !nomatch!
  45. q0j
  46. 0u0
  47. 
  48. !& Fix Mail-From:! !C Fixes up any initial "Mail-from:" line.
  49. Some "date" lines actually begin with "Mail-from" and contain
  50. additional information not wanted here. Cursor is left at the
  51. beginning of the same line it started on.!
  52. .,.+10:FBMail-from: :"L Oend'
  53. 0l
  54. iDate:
  55. 1MM^R_Kill_Word
  56. 1MM^R_Kill_Word
  57. 1MM^R_Kill_Word
  58. 1MM^R_Kill_Word
  59. !end!
  60. 0l
  61. 
  62. !Reverse Mail List:! !C Reverses a bufferful of mail messages.
  63. The idea is to move forward through the file putting messages
  64. found later in front of all found sooner.!
  65. [0 [1 [2 [3
  66. .u2 !* q2 has loc of last header found!
  67. <
  68. .-z "E ' !* Stop reversing if at end of buffer!
  69. < !* Find "end of message"!
  70. l !* Go to next line!
  71. .-z @; !* Exit if at end of buffer!
  72. MM&_Header?
  73. q0 :@; !* Exit if header line (q0 nonzero)!
  74. >
  75. !* End of message now found!
  76. q2u1 !* Now q1 has prev. header!
  77. .u2 !* q2 has next header loc!
  78. q1,q2x3 !* Save message in q3!
  79. q1,q2k !* Kill message!
  80. bj g3 !* Put at front of buffer!
  81. q2j !* Go to where left off!
  82. >
  83.