Article View: gnu.emacs.bug
Article #87186sendmail output to FCC file
From: John Lee
Date: Wed, 12 Oct 1994 23:07
Date: Wed, 12 Oct 1994 23:07
121 lines
5680 bytes
5680 bytes
In GNU Emacs 19.25.1 of Mon Oct 3 1994 on zeno.math.washington.edu
(mips-dec-ultrix4.2):
When sendmail writes a copy of its outgoing message to the file specified
in the FCC field, it ordinarily writes it in Unix mail format. In Emacs
18, this caused problems when the FCC file was an Rmail file currently in a
buffer, but Emacs 19 contains code to correct this by converting the
message to Rmail format in that case. However, under Emacs 19 there is
still a problem when the FCC file is an Rmail file on disk. The problem
arises as follows: Suppose "savefile" is an Rmail file on disk. If I save
an outgoing message in savefile (by including "FCC: ~/savefile" in the
header), and then save an incoming message in the same file (by giving the
command rmail-output-to-rmail-file inside rmail), then "savefile" is
ruined, because it contains a Babyl header, followed by a Unix-format
message, followed by an Rmail-format message, and
rmail-convert-to-babyl-format can't fix it.
I know the documentation for FCC says `do not output directly into an Rmail
file with FCC; instead, output to an inbox file and "get new mail" from
that inbox file into the Rmail file.' However, this seems like a silly
restriction, because it makes FCC no more useful than mailing myself a
blind copy via BCC: I still have to look once more at the outgoing message
and decide where to put it. It would make more sense for sendmail to
handle Rmail files correctly.
Below is a simple fix that I worked out for this problem. If there is an
FCC field in an outgoing message, then sendmail converts the outgoing
message to Rmail format and uses rmail-output-to-rmail-file to write it.
This works correctly for all the cases I tested (Rmail file in buffer or on
disk, Unix mail file in buffer or on disk). I'm not deeply familiar with
elisp, so there may be subtleties that I haven't thought of, but the code
is so simple it should be possible for the experts to spot them right
away.
--
Jack Lee
Dept. of Mathematics
University of Washington
Seattle, WA
==============================================================================
*** /usr/local/lib/emacs/19.25/lisp/sendmail.el Sun May 22 21:53:13 1994
--- sendmail.el Wed Oct 12 12:33:40 1994
***************
*** 503,556 ****
(while (search-forward "\nFrom " nil t)
(forward-char -5)
(insert ?>)))
! (while fcc-list
! (let ((buffer (get-file-buffer (car fcc-list))))
! (if buffer
! ;; File is present in a buffer => append to that buffer.
! (let ((curbuf (current-buffer))
! (beg (point-min)) (end (point-max))
! (beg2 (save-excursion (goto-char (point-min))
! (forward-line 2) (point))))
! (save-excursion
! (set-buffer buffer)
! ;; Keep the end of the accessible portion at the same place
! ;; unless it is the end of the buffer.
! (let ((max (if (/= (1+ (buffer-size)) (point-max))
! (point-max))))
! (unwind-protect
! ;; Code below lifted from rmailout.el
! ;; function rmail-output-to-rmail-file:
! (let ((buffer-read-only nil)
! (msg (and (boundp 'rmail-current-message)
! rmail-current-message)))
! ;; If MSG is non-nil, buffer is in RMAIL mode.
! (if msg
! (progn
! (rmail-maybe-set-message-counters)
! (widen)
! (narrow-to-region (point-max) (point-max))
! (insert "\C-l\n0, unseen,,\n*** EOOH ***\n"
! "From: " (user-login-name) "\n"
! "Date: " (mail-rfc822-date) "\n")
! (insert-buffer-substring curbuf beg2 end)
! (insert "\n\C-_")
! (goto-char (point-min))
! (widen)
! (search-backward "\n\^_")
! (narrow-to-region (point) (point-max))
! (rmail-count-new-messages t)
! (rmail-show-message msg)
! (setq max nil))
! ;; Output file not in rmail mode
! ;; => just insert at the end.
! (narrow-to-region (point-min) (1+ (buffer-size)))
! (goto-char (point-max))
! (insert-buffer-substring curbuf beg end)))
! (if max (narrow-to-region (point-min) max))))))
! ;; Else append to the file directly.
! (write-region
! (1+ (point-min)) (point-max) (car fcc-list) t)))
! (setq fcc-list (cdr fcc-list))))
(kill-buffer tembuf)))
(defun mail-sent-via ()
--- 513,533 ----
(while (search-forward "\nFrom " nil t)
(forward-char -5)
(insert ?>)))
!
! ;; *** JML changes 10/12/94
! (if fcc-list
! (progn
! (require 'rmail)
! (rmail-mode)
! (rmail-convert-file)
! (goto-char (point-max))
! (rmail-set-message-counters)
! (rmail-show-message)
! (while fcc-list
! (rmail-output-to-rmail-file (car fcc-list))
! (setq fcc-list (cdr fcc-list))))))
! ;; *** end JML changes ****************
!
(kill-buffer tembuf)))
(defun mail-sent-via ()
Technical Details
Message-ID:
<9410122304.AA28113@runners.math.washington.edu>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!mhv.net!metro.atlanta.com!emory!swrinde!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!math.washington.edu!leeShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,efc4980a376498bc,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1994-10-12 21:26:37 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!mhv.net!metro.atlanta.com!emory!swrinde!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!math.washington.edu!lee From: lee@math.washington.edu (John Lee) Newsgroups: gnu.emacs.bug Subject: sendmail output to FCC file Date: 12 Oct 1994 19:07:54 -0400 Organization: GNUs Not Usenet Lines: 121 Sender: daemon@cis.ohio-state.edu Approved: bug-gnu-emacs@prep.ai.mit.edu Distribution: gnu Message-ID: <9410122304.AA28113@runners.math.washington.edu>