Mercurial > emacs
annotate lisp/mail/undigest.el @ 27007:2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 28 Dec 1999 03:35:51 +0000 |
parents | 7be5edf3710f |
children | 7d643cf235ad |
rev | line source |
---|---|
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
1 ;;; undigest.el --- digest-cracking support for the RMAIL mail reader |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
2 |
14734 | 3 ;; Copyright (C) 1985, 1986, 1994, 1996 Free Software Foundation, Inc. |
841 | 4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
5 ;; Maintainer: FSF |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: mail |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
7 |
35 | 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 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
35 | 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. | |
35 | 24 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
25 ;;; Commentary: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
26 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
27 ;; See Internet RFC 934 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
28 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
29 ;;; Code: |
35 | 30 |
7038
e640d438df9a
(undigestify-rmail-message): Update summary buffer.
Karl Heuer <kwzh@gnu.org>
parents:
841
diff
changeset
|
31 (require 'rmail) |
e640d438df9a
(undigestify-rmail-message): Update summary buffer.
Karl Heuer <kwzh@gnu.org>
parents:
841
diff
changeset
|
32 |
16348
2cf33d3c5540
Add many autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
15438
diff
changeset
|
33 ;;;###autoload |
35 | 34 (defun undigestify-rmail-message () |
35 "Break up a digest message into its constituent messages. | |
36 Leaves original message, deleted, before the undigestified messages." | |
37 (interactive) | |
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
38 (with-current-buffer rmail-buffer |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
39 (widen) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
40 (let ((buffer-read-only nil) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
41 (msg-string (buffer-substring (rmail-msgbeg rmail-current-message) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
42 (rmail-msgend rmail-current-message)))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
43 (goto-char (rmail-msgend rmail-current-message)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
44 (narrow-to-region (point) (point)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
45 (insert msg-string) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
46 (narrow-to-region (point-min) (1- (point-max)))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
47 (let ((error t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
48 (buffer-read-only nil)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
49 (unwind-protect |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
50 (progn |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
51 (save-restriction |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
52 (goto-char (point-min)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
53 (delete-region (point-min) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
54 (progn (search-forward "\n*** EOOH ***\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
55 (point))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
56 (insert "\^_\^L\n0, unseen,,\n*** EOOH ***\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
57 (narrow-to-region (point) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
58 (point-max)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
59 (let* ((fill-prefix "") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
60 (case-fold-search t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
61 start |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
62 (digest-name |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
63 (mail-strip-quoted-names |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
64 (or (save-restriction |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
65 (search-forward "\n\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
66 (setq start (point)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
67 (narrow-to-region (point-min) (point)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
68 (goto-char (point-max)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
69 (or (mail-fetch-field "Reply-To") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
70 (mail-fetch-field "To") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
71 (mail-fetch-field "Apparently-To") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
72 (mail-fetch-field "From"))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
73 (error "Message is not a digest--bad header"))))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
74 (save-excursion |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
75 (goto-char (point-max)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
76 (skip-chars-backward " \t\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
77 (let (found) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
78 ;; compensate for broken un*x digestifiers. Sigh Sigh. |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
79 (while (and (> (point) start) (not found)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
80 (forward-line -1) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
81 (if (looking-at (concat "End of.*Digest.*\n" |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
82 (regexp-quote "*********") "*" |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
83 "\\(\n------*\\)*")) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
84 (setq found t))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
85 (if (not found) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
86 (error "Message is not a digest--no end line")))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
87 (re-search-forward (concat "^" (make-string 55 ?-) "-*\n*")) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
88 (replace-match "\^_\^L\n0, unseen,,\n*** EOOH ***\n") |
35 | 89 (save-restriction |
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
90 (narrow-to-region (point) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
91 (progn (search-forward "\n\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
92 (point))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
93 (if (mail-fetch-field "To") nil |
35 | 94 (goto-char (point-min)) |
11498
da7bbadf9999
(undigestify-rmail-message): Strip "^- " which is
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
95 (insert "To: " digest-name "\n"))) |
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
96 (while (re-search-forward |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
97 (concat "\n\n" (make-string 27 ?-) "-*\n*") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
98 nil t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
99 (replace-match "\n\n\^_\^L\n0, unseen,,\n*** EOOH ***\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
100 (save-restriction |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
101 (if (looking-at "End ") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
102 (insert "To: " digest-name "\n\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
103 (narrow-to-region (point) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
104 (progn (search-forward "\n\n" |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
105 nil 'move) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
106 (point)))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
107 (if (mail-fetch-field "To") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
108 nil |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
109 (goto-char (point-min)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
110 (insert "To: " digest-name "\n"))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
111 ;; Digestifiers may insert `- ' on lines that start with `-'. |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
112 ;; Undo that. |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
113 (save-excursion |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
114 (goto-char (point-min)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
115 (if (re-search-forward |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
116 "\n\n----------------------------*\n*" |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
117 nil t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
118 (let ((end (point-marker))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
119 (goto-char (point-min)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
120 (while (re-search-forward "^- " end t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
121 (delete-char -2))))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
122 ))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
123 (setq error nil) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
124 (message "Message successfully undigestified") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
125 (let ((n rmail-current-message)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
126 (rmail-forget-messages) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
127 (rmail-show-message n) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
128 (rmail-delete-forward) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
129 (if (rmail-summary-exists) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
130 (rmail-select-summary |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
131 (rmail-update-summary))))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
132 (cond (error |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
133 (narrow-to-region (point-min) (1+ (point-max))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
134 (delete-region (point-min) (point-max)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
135 (rmail-show-message rmail-current-message))))))) |
35 | 136 |
16348
2cf33d3c5540
Add many autoload cookies.
Richard M. Stallman <rms@gnu.org>
parents:
15438
diff
changeset
|
137 ;;;###autoload |
14630
584eb99710a6
(unforward-rmail-message): New command.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
138 (defun unforward-rmail-message () |
584eb99710a6
(unforward-rmail-message): New command.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
139 "Extract a forwarded message from the containing message. |
584eb99710a6
(unforward-rmail-message): New command.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
140 This puts the forwarded message into a separate rmail message |
584eb99710a6
(unforward-rmail-message): New command.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
141 following the containing message." |
584eb99710a6
(unforward-rmail-message): New command.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
142 (interactive) |
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
143 ;; If we are in a summary buffer, switch to the Rmail buffer. |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
144 (with-current-buffer rmail-buffer |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
145 (narrow-to-region (rmail-msgbeg rmail-current-message) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
146 (rmail-msgend rmail-current-message)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
147 (goto-char (point-min)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
148 (let (beg end (buffer-read-only nil) msg-string who-forwarded-it) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
149 (setq who-forwarded-it (mail-fetch-field "From")) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
150 (if (re-search-forward "^----" nil t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
151 nil |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
152 (error "No forwarded message")) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
153 (forward-line 1) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
154 (setq beg (point)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
155 (if (re-search-forward "^----" nil t) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
156 (setq end (match-beginning 0)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
157 (error "No terminator for forwarded message")) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
158 (widen) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
159 (setq msg-string (buffer-substring beg end)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
160 (goto-char (rmail-msgend rmail-current-message)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
161 (narrow-to-region (point) (point)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
162 (insert "\^_\^L\n0, unseen,,\n*** EOOH ***\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
163 (narrow-to-region (point) (point)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
164 (insert "Forwarded-by: " who-forwarded-it "\n") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
165 (insert msg-string) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
166 (goto-char (point-min)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
167 (while (not (eobp)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
168 (if (looking-at "- ") |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
169 (delete-region (point) (+ 2 (point)))) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
170 (forward-line 1)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
171 (let ((n rmail-current-message)) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
172 (rmail-forget-messages) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
173 (rmail-show-message n) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
174 (if (rmail-summary-exists) |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
175 (rmail-select-summary |
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
parents:
18383
diff
changeset
|
176 (rmail-update-summary))))))) |
14630
584eb99710a6
(unforward-rmail-message): New command.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
177 |
18383 | 178 (provide 'undigest) |
179 | |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
180 ;;; undigest.el ends here |