aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-06-16 18:23:28 +0000
committerRichard M. Stallman1996-06-16 18:23:28 +0000
commitd614dd91b7db40d4ecce633c9f9185bdab4e2f94 (patch)
treed3e9298e8f655a676814124a9f511acc355c14a4
parent7e49eef26e84cd506dda1e697d4388f6cf246669 (diff)
downloademacs-d614dd91b7db40d4ecce633c9f9185bdab4e2f94.tar.gz
emacs-d614dd91b7db40d4ecce633c9f9185bdab4e2f94.zip
(unforward-rmail-message): In summary buffer,
switch temporarily to Rmail buffer.
-rw-r--r--lisp/mail/undigest.el73
1 files changed, 41 insertions, 32 deletions
diff --git a/lisp/mail/undigest.el b/lisp/mail/undigest.el
index 80c7b3cfb39..c2d2414394a 100644
--- a/lisp/mail/undigest.el
+++ b/lisp/mail/undigest.el
@@ -137,37 +137,46 @@ Leaves original message, deleted, before the undigestified messages."
137This puts the forwarded message into a separate rmail message 137This puts the forwarded message into a separate rmail message
138following the containing message." 138following the containing message."
139 (interactive) 139 (interactive)
140 (narrow-to-region (rmail-msgbeg rmail-current-message) 140 ;; Don't use save-excursion because we don't want to restore point
141 (rmail-msgend rmail-current-message)) 141 ;; in the case where we do not switch buffers.
142 (goto-char (point-min)) 142 (let ((obuf (current-buffer)))
143 (let (beg end (buffer-read-only nil) msg-string who-forwarded-it) 143 (unwind-protect
144 (setq who-forwarded-it (mail-fetch-field "From")) 144 (progn
145 (if (re-search-forward "^----" nil t) 145 ;; If we are in a summary buffer, switch to the Rmail buffer.
146 nil 146 (if (local-variable-p 'rmail-buffer)
147 (error "No forwarded message")) 147 (set-buffer rmail-buffer))
148 (forward-line 1) 148 (narrow-to-region (rmail-msgbeg rmail-current-message)
149 (setq beg (point)) 149 (rmail-msgend rmail-current-message))
150 (if (re-search-forward "^----" nil t) 150 (goto-char (point-min))
151 (setq end (match-beginning 0)) 151 (let (beg end (buffer-read-only nil) msg-string who-forwarded-it)
152 (error "No terminator for forwarded message")) 152 (setq who-forwarded-it (mail-fetch-field "From"))
153 (widen) 153 (if (re-search-forward "^----" nil t)
154 (setq msg-string (buffer-substring beg end)) 154 nil
155 (goto-char (rmail-msgend rmail-current-message)) 155 (error "No forwarded message"))
156 (narrow-to-region (point) (point)) 156 (forward-line 1)
157 (insert "\^_\^L\n0, unseen,,\n*** EOOH ***\n") 157 (setq beg (point))
158 (narrow-to-region (point) (point)) 158 (if (re-search-forward "^----" nil t)
159 (insert "Forwarded-by: " who-forwarded-it "\n") 159 (setq end (match-beginning 0))
160 (insert msg-string) 160 (error "No terminator for forwarded message"))
161 (goto-char (point-min)) 161 (widen)
162 (while (not (eobp)) 162 (setq msg-string (buffer-substring beg end))
163 (if (looking-at "- ") 163 (goto-char (rmail-msgend rmail-current-message))
164 (delete-region (point) (+ 2 (point)))) 164 (narrow-to-region (point) (point))
165 (forward-line 1)) 165 (insert "\^_\^L\n0, unseen,,\n*** EOOH ***\n")
166 (let ((n rmail-current-message)) 166 (narrow-to-region (point) (point))
167 (rmail-forget-messages) 167 (insert "Forwarded-by: " who-forwarded-it "\n")
168 (rmail-show-message n) 168 (insert msg-string)
169 (if (rmail-summary-exists) 169 (goto-char (point-min))
170 (rmail-select-summary 170 (while (not (eobp))
171 (rmail-update-summary)))))) 171 (if (looking-at "- ")
172 (delete-region (point) (+ 2 (point))))
173 (forward-line 1))
174 (let ((n rmail-current-message))
175 (rmail-forget-messages)
176 (rmail-show-message n)
177 (if (rmail-summary-exists)
178 (rmail-select-summary
179 (rmail-update-summary))))))
180 (set-buffer obuf))))
172 181
173;;; undigest.el ends here 182;;; undigest.el ends here