Mercurial > emacs
annotate lisp/mail/unrmail.el @ 88146:a64fe1ff909a
(rmail-make-summary-line): Function deleted.
(rmail-new-summary): Make it work once again as in old version.
(rmail-summary-get-summary): Call rmail-summary-line-decoder.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 27 Sep 2004 07:41:10 +0000 |
parents | 0ccb1fcb32c7 |
children | ef41980f1588 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
1 ;;; unrmail.el --- convert Rmail files to mailbox files |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
982
diff
changeset
|
2 |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
3 ;;; Copyright (C) 1992, 2002 Free Software Foundation, Inc. |
982 | 4 |
38695 | 5 ;; Maintainer: FSF |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2233
diff
changeset
|
6 ;; Keywords: mail |
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2233
diff
changeset
|
7 |
982 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
982 | 24 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
25 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
18383
diff
changeset
|
26 |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
982
diff
changeset
|
27 ;;; Code: |
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
982
diff
changeset
|
28 |
982 | 29 (defvar command-line-args-left) ;Avoid 'free variable' warning |
30 | |
31 ;;;###autoload | |
32 (defun batch-unrmail () | |
6618 | 33 "Convert Rmail files to system inbox format. |
982 | 34 Specify the input Rmail file names as command line arguments. |
35 For each Rmail file, the corresponding output file name | |
36 is made by adding `.mail' at the end. | |
37 For example, invoke `emacs -batch -f batch-unrmail RMAIL'." | |
38 ;; command-line-args-left is what is left of the command line (from startup.el) | |
39 (if (not noninteractive) | |
40 (error "`batch-unrmail' is to be used only with -batch")) | |
41 (let ((error nil)) | |
42 (while command-line-args-left | |
43 (or (unrmail (car command-line-args-left) | |
44 (concat (car command-line-args-left) ".mail")) | |
45 (setq error t)) | |
46 (setq command-line-args-left (cdr command-line-args-left))) | |
47 (message "Done") | |
48 (kill-emacs (if error 1 0)))) | |
49 | |
50 ;;;###autoload | |
51 (defun unrmail (file to-file) | |
6618 | 52 "Convert Rmail file FILE to system inbox format file TO-FILE." |
4266
5a7266ff9af1
(unrmail): Total rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
2247
diff
changeset
|
53 (interactive "fUnrmail (rmail file): \nFUnrmail into (new mailbox file): ") |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
54 (let ((message-count 1) |
11177
6a26526998f6
(unrmail): Don't make or switch to a summary buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6618
diff
changeset
|
55 ;; Prevent rmail from making, or switching to, a summary buffer. |
6a26526998f6
(unrmail): Don't make or switch to a summary buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6618
diff
changeset
|
56 (rmail-display-summary nil) |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
57 (rmail-delete-after-output nil) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
58 (temp-buffer (get-buffer-create " unrmail"))) |
88131
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
59 ; (rmail file) |
14296
e3e1d7c2e7e5
(unrmail): Default the directory of TO-FILE based on FILE.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
60 ;; Default the directory of TO-FILE based on where FILE is. |
e3e1d7c2e7e5
(unrmail): Default the directory of TO-FILE based on FILE.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
61 (setq to-file (expand-file-name to-file default-directory)) |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
62 (condition-case () |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
63 (delete-file to-file) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
64 (file-error nil)) |
4266
5a7266ff9af1
(unrmail): Total rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
2247
diff
changeset
|
65 (message "Writing messages to %s..." to-file) |
88131
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
66 (if (save-restriction |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
67 (save-excursion |
88131
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
68 (widen) |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
69 (goto-char (point-min)) |
88131
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
70 (not (looking-at "BABYL OPTIONS")))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
71 (write-region (point-min) (point-max) to-file t 'nomsg) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
72 (save-restriction |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
73 (widen) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
74 (while (<= message-count rmail-total-messages) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
75 (let ((beg (rmail-msgbeg message-count)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
76 (end (rmail-msgbeg (1+ message-count))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
77 (from-buffer (current-buffer)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
78 (coding (or rmail-file-coding-system 'raw-text)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
79 label-line attrs keywords |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
80 header-beginning mail-from) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
81 (save-excursion |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
82 (goto-char (rmail-msgbeg message-count)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
83 (setq header-beginning (point)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
84 (search-forward "\n*** EOOH ***\n") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
85 (forward-line -1) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
86 (search-forward "\n\n") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
87 (save-restriction |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
88 (narrow-to-region header-beginning (point)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
89 (setq mail-from |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
90 (or (mail-fetch-field "Mail-From") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
91 (concat "From " |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
92 (mail-strip-quoted-names (or (mail-fetch-field "from") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
93 (mail-fetch-field "really-from") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
94 (mail-fetch-field "sender") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
95 "unknown")) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
96 " " (current-time-string)))))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
97 (with-current-buffer temp-buffer |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
98 (setq buffer-undo-list t) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
99 (erase-buffer) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
100 (setq buffer-file-coding-system coding) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
101 (insert-buffer-substring from-buffer beg end) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
102 (goto-char (point-min)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
103 (forward-line 1) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
104 (setq label-line |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
105 (buffer-substring (point) |
88131
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
106 (progn (forward-line 1) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
107 (point)))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
108 (forward-line -1) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
109 (search-forward ",,") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
110 (unless (eolp) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
111 (setq keywords |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
112 (buffer-substring (point) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
113 (progn (end-of-line) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
114 (1- (point))))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
115 (setq keywords |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
116 (replace-regexp-in-string ", " "," keywords))) |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
117 |
88131
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
118 (setq attrs |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
119 (list |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
120 (if (string-match ", answered," label-line) ?A ?-) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
121 (if (string-match ", deleted," label-line) ?D ?-) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
122 (if (string-match ", edited," label-line) ?E ?-) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
123 (if (string-match ", filed," label-line) ?F ?-) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
124 (if (string-match ", resent," label-line) ?R ?-) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
125 (if (string-match ", unseen," label-line) ?\ ?-) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
126 (if (string-match ", stored," label-line) ?S ?-))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
127 (unrmail-unprune) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
128 (goto-char (point-min)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
129 (insert mail-from "\n") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
130 (insert "X-BABYL-V6-ATTRIBUTES: " (apply 'string attrs) "\n") |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
131 (when keywords |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
132 (insert "X-BABYL-V6-KEYWORDS: " keywords "\n")) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
133 (goto-char (point-min)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
134 ;; ``Quote'' "\nFrom " as "\n>From " |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
135 ;; (note that this isn't really quoting, as there is no requirement |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
136 ;; that "\n[>]+From " be quoted in the same transparent way.) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
137 (let ((case-fold-search nil)) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
138 (while (search-forward "\nFrom " nil t) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
139 (forward-char -5) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
140 (insert ?>))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
141 (write-region (point-min) (point-max) to-file t |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
142 'nomsg))) |
0ccb1fcb32c7
(unrmail, rmail-unprune): Mbox conversion.
Paul Reilly <pmr@pajato.com>
parents:
47631
diff
changeset
|
143 (setq message-count (1+ message-count))))) |
4266
5a7266ff9af1
(unrmail): Total rewrite.
Richard M. Stallman <rms@gnu.org>
parents:
2247
diff
changeset
|
144 (message "Writing messages to %s...done" to-file))) |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
982
diff
changeset
|
145 |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
146 (defun unrmail-unprune () |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
147 (let* ((pruned |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
148 (save-excursion |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
149 (goto-char (point-min)) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
150 (forward-line 1) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
151 (= (following-char) ?1)))) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
152 (if pruned |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
153 (progn |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
154 (goto-char (point-min)) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
155 (forward-line 2) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
156 ;; Delete Summary-Line headers. |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
157 (let ((case-fold-search t)) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
158 (while (looking-at "Summary-Line:") |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
159 (forward-line 1))) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
160 (delete-region (point-min) (point)) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
161 ;; Delete the old reformatted header. |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
162 (re-search-forward "^[*][*][*] EOOH [*][*][*]\n") |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
163 (forward-line -1) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
164 (let ((start (point))) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
165 (search-forward "\n\n") |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
166 (delete-region start (point)))) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
167 ;; Delete everything up to the real header. |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
168 (goto-char (point-min)) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
169 (re-search-forward "^[*][*][*] EOOH [*][*][*]\n") |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
170 (delete-region (point-min) (point))) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
171 (goto-char (point-min)) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
172 (when (re-search-forward "^Mail-from:") |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
173 (beginning-of-line) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
174 (delete-region (point) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
175 (progn (forward-line 1) (point)))))) |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
176 |
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
177 |
18383 | 178 (provide 'unrmail) |
179 | |
2233
fb0ed5a1d0f3
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
982
diff
changeset
|
180 ;;; unrmail.el ends here |
47631
433ae412d00f
(unrmail): Do the work directly,
Richard M. Stallman <rms@gnu.org>
parents:
38695
diff
changeset
|
181 |