657
|
1 ;;; undigest.el --- digest-cracking support for the RMAIL mail reader
|
|
2
|
14734
|
3 ;; Copyright (C) 1985, 1986, 1994, 1996 Free Software Foundation, Inc.
|
841
|
4
|
807
|
5 ;; Maintainer: FSF
|
814
|
6 ;; Keywords: mail
|
807
|
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
|
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
|
25 ;;; Commentary:
|
|
26
|
|
27 ;; See Internet RFC 934
|
|
28
|
|
29 ;;; Code:
|
35
|
30
|
7038
|
31 (require 'rmail)
|
|
32
|
27375
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
33 (defcustom rmail-digest-end-regexps
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
34 (list (concat "End of.*Digest.*\n"
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
35 (regexp-quote "*********") "*"
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
36 "\\(\n------*\\)*")
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
37 (concat "End of.*\n"
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
38 (regexp-quote "*") "*"))
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
39 "*Regexps matching the end of a digest message."
|
27360
|
40 :group 'rmail
|
27375
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
41 :type '(repeat regexp))
|
27360
|
42
|
16348
|
43 ;;;###autoload
|
35
|
44 (defun undigestify-rmail-message ()
|
|
45 "Break up a digest message into its constituent messages.
|
|
46 Leaves original message, deleted, before the undigestified messages."
|
|
47 (interactive)
|
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
48 (with-current-buffer rmail-buffer
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
49 (widen)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
50 (let ((buffer-read-only nil)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
51 (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>
diff
changeset
|
52 (rmail-msgend rmail-current-message))))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
53 (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>
diff
changeset
|
54 (narrow-to-region (point) (point))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
55 (insert msg-string)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
56 (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>
diff
changeset
|
57 (let ((error t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
58 (buffer-read-only nil))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
59 (unwind-protect
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
60 (progn
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
61 (save-restriction
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
62 (goto-char (point-min))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
63 (delete-region (point-min)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
64 (progn (search-forward "\n*** EOOH ***\n")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
65 (point)))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
66 (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>
diff
changeset
|
67 (narrow-to-region (point)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
68 (point-max))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
69 (let* ((fill-prefix "")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
70 (case-fold-search t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
71 start
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
72 (digest-name
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
73 (mail-strip-quoted-names
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
74 (or (save-restriction
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
75 (search-forward "\n\n")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
76 (setq start (point))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
77 (narrow-to-region (point-min) (point))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
78 (goto-char (point-max))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
79 (or (mail-fetch-field "Reply-To")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
80 (mail-fetch-field "To")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
81 (mail-fetch-field "Apparently-To")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
82 (mail-fetch-field "From")))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
83 (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>
diff
changeset
|
84 (save-excursion
|
27375
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
85 (let (found
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
86 (regexps rmail-digest-end-regexps))
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
87 (while (and regexps (not found))
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
88 (goto-char (point-max))
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
89 (skip-chars-backward " \t\n")
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
90 ;; compensate for broken un*x digestifiers. Sigh Sigh.
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
91 (while (and (> (point) start) (not found))
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
92 (forward-line -1)
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
93 (if (looking-at (car regexps))
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
94 (setq found t))
|
27386
|
95 (setq regexps (cdr regexps))))
|
27375
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
96 (unless found
|
517cdf51989f
(rmail-digest-end-regexps): Variable replaces rmail-digest-end-regexp.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
97 (error "Message is not a digest--no end line"))))
|
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
98 (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>
diff
changeset
|
99 (replace-match "\^_\^L\n0, unseen,,\n*** EOOH ***\n")
|
35
|
100 (save-restriction
|
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
101 (narrow-to-region (point)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
102 (progn (search-forward "\n\n")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
103 (point)))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
104 (if (mail-fetch-field "To") nil
|
35
|
105 (goto-char (point-min))
|
11498
|
106 (insert "To: " digest-name "\n")))
|
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
107 (while (re-search-forward
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
108 (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>
diff
changeset
|
109 nil t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
110 (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>
diff
changeset
|
111 (save-restriction
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
112 (if (looking-at "End ")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
113 (insert "To: " digest-name "\n\n")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
114 (narrow-to-region (point)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
115 (progn (search-forward "\n\n"
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
116 nil 'move)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
117 (point))))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
118 (if (mail-fetch-field "To")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
119 nil
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
120 (goto-char (point-min))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
121 (insert "To: " digest-name "\n")))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
122 ;; 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>
diff
changeset
|
123 ;; Undo that.
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
124 (save-excursion
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
125 (goto-char (point-min))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
126 (if (re-search-forward
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
127 "\n\n----------------------------*\n*"
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
128 nil t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
129 (let ((end (point-marker)))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
130 (goto-char (point-min))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
131 (while (re-search-forward "^- " end t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
132 (delete-char -2)))))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
133 )))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
134 (setq error nil)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
135 (message "Message successfully undigestified")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
136 (let ((n rmail-current-message))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
137 (rmail-forget-messages)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
138 (rmail-show-message n)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
139 (rmail-delete-forward)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
140 (if (rmail-summary-exists)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
141 (rmail-select-summary
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
142 (rmail-update-summary)))))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
143 (cond (error
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
144 (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>
diff
changeset
|
145 (delete-region (point-min) (point-max))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
146 (rmail-show-message rmail-current-message)))))))
|
35
|
147
|
16348
|
148 ;;;###autoload
|
14630
|
149 (defun unforward-rmail-message ()
|
|
150 "Extract a forwarded message from the containing message.
|
|
151 This puts the forwarded message into a separate rmail message
|
|
152 following the containing message."
|
|
153 (interactive)
|
20520
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
154 ;; 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>
diff
changeset
|
155 (with-current-buffer rmail-buffer
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
156 (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>
diff
changeset
|
157 (rmail-msgend rmail-current-message))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
158 (goto-char (point-min))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
159 (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>
diff
changeset
|
160 (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>
diff
changeset
|
161 (if (re-search-forward "^----" nil t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
162 nil
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
163 (error "No forwarded message"))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
164 (forward-line 1)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
165 (setq beg (point))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
166 (if (re-search-forward "^----" nil t)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
167 (setq end (match-beginning 0))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
168 (error "No terminator for forwarded message"))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
169 (widen)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
170 (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>
diff
changeset
|
171 (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>
diff
changeset
|
172 (narrow-to-region (point) (point))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
173 (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>
diff
changeset
|
174 (narrow-to-region (point) (point))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
175 (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>
diff
changeset
|
176 (insert msg-string)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
177 (goto-char (point-min))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
178 (while (not (eobp))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
179 (if (looking-at "- ")
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
180 (delete-region (point) (+ 2 (point))))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
181 (forward-line 1))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
182 (let ((n rmail-current-message))
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
183 (rmail-forget-messages)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
184 (rmail-show-message n)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
185 (if (rmail-summary-exists)
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
186 (rmail-select-summary
|
7be5edf3710f
(undigestify-rmail-message): If in summary, switch to the Rmail buffer.
Richard M. Stallman <rms@gnu.org>
diff
changeset
|
187 (rmail-update-summary)))))))
|
14630
|
188
|
18383
|
189 (provide 'undigest)
|
|
190
|
657
|
191 ;;; undigest.el ends here
|