home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!edscom.demon.co.uk!kevin
- From: kevin@edscom.demon.co.uk (Kevin Broadey)
- Newsgroups: gnu.emacs.bug
- Subject: Re: rmail/sendmail bug
- Message-ID: <KEVIN.92Sep10113959@runningbear.edscom.demon.co.uk>
- Date: 10 Sep 92 11:39:59 GMT
- References: kevin@edscom.demon.co.uk (Kevin Broadey)
- Sender: gnulists@ai.mit.edu
- Reply-To: Kevin Broadey <kbroadey@edscom.demon.co.uk>
- Distribution: gnu
- Organization: EDS-Scicon, Milton Keynes, UK
- Lines: 148
- Approved: bug-gnu-emacs@prep.ai.mit.edu
-
- >>>>> In article <9209092336.AA25413@ams.sunysb.edu>, "hho" ==
- >>>>> hanche@ams.sunysb.edu (Harald Hanche-Olsen) writes:
-
- hho> The following bug manifests itself when emacs tries to convert
- hho> a file from mbox format to Babyl format. Here is how to
- hho> reproduce it:
-
- hho> [...]
-
- hho> I tried correcting it to allow either variant, only to discover
- hho> that rmail-nuke-pinhead-header does the same. And fixing it
- hho> would be a tad more complicated, due to the replace-match using
- hho> the regexp. Rather than waste more time trying to correct
- hho> this, I decided to report the bug. I am not quite sure where
- hho> is the "right" place to correct it - in mail-do-fcc or the
- hho> other places.
-
- hho> Also, I would be very surprised if this bug has not already
- hho> been reported and corrected, so maybe you have a fix ready?
-
- You're right, it's already been found and fixed. I posted an article
- about it last month.
-
- The fault is in `mail-do-fcc' because it isn't putting the time in the
- correct UNIX mail format. The fix is to use the output from the UNIX
- `date' command instead of (current-time-string).
-
- In Emacs 18.58 there's already a call to `date', but this is just used
- to get the timezone - all the other info is discarded!
-
- Attached is the diffs from sendmail.el in Emacs 18.58. This also fixes
- another sendmail/rmail FCC problem - sendmail doesn't check to see
- whether the FCC file is being visited by emacs, it just appends the
- message to the disk file. I've changed it so it will append it to the
- buffer instead, and if the buffer is in RMAIL mode, convert the message
- to BABYL format and update all RMAIL's info.
-
- --Kevin
-
- -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip --
-
- *** /usr/local/gnu/emacs-18.58/lisp/sendmail.el Tue Jan 28 21:22:56 1992
- --- ./sendmail.el Wed Sep 2 19:20:14 1992
- ***************
- *** 17,22 ****
- --- 17,34 ----
- ;; along with GNU Emacs; see the file COPYING. If not, write to
- ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-
- + ;; 02-09-92 Kevin Broadey EDS-Scicon
- + ;; File Carbon Copy feature: Change mail-do-fcc to spot when the buffer
- + ;; visiting the FCC file is in RMAIL mode and make it append the message in
- + ;; BABYL format, updating rmail's variables as well. Also, ask whether to
- + ;; append to a read-only buffer instead of bombing out.
- + ;;
- + ;; This has been unashamedly lifted from the GNUS `gnus-output-to-rmail'
- + ;; function.
- + ;;
- + ;; Also, fix longstanding bug in FCC: Use UNIX `date' instead of
- + ;; `current-time-string' to get timestamp so Rmail parses it successfully when
- + ;; converting to BABYL format.
-
- (provide 'sendmail)
-
- ***************
- *** 259,265 ****
- (defun mail-do-fcc (header-end)
- (let (fcc-list
- (rmailbuf (current-buffer))
- - timezone
- (tembuf (generate-new-buffer " rmail output"))
- (case-fold-search t))
- (save-excursion
- --- 271,276 ----
- ***************
- *** 275,289 ****
- (progn (forward-line 1) (point))))
- (set-buffer tembuf)
- (erase-buffer)
- (call-process "date" nil t nil)
- - (end-of-line)
- - (forward-word -1)
- - (delete-region (1- (point)) (point-max))
- - (forward-word -1)
- - (setq timezone (buffer-substring (point) (point-max)))
- - (erase-buffer)
- - (insert "\nFrom " (user-login-name) " "
- - (current-time-string) " " timezone "\n")
- (insert-buffer-substring rmailbuf)
- ;; Make sure messages are separated.
- (goto-char (point-max))
- --- 286,293 ----
- (progn (forward-line 1) (point))))
- (set-buffer tembuf)
- (erase-buffer)
- + (insert "\nFrom " (user-login-name) " ")
- (call-process "date" nil t nil)
- (insert-buffer-substring rmailbuf)
- ;; Make sure messages are separated.
- (goto-char (point-max))
- ***************
- *** 302,311 ****
- ;; File is present in a buffer => append to that buffer.
- (let ((curbuf (current-buffer))
- (beg (point-min)) (end (point-max)))
- ! (save-excursion
- ! (set-buffer buffer)
- ! (goto-char (point-max))
- ! (insert-buffer-substring curbuf beg end)))
- ;; Else append to the file directly.
- (write-region (point-min) (point-max) (car fcc-list) t)))
- (setq fcc-list (cdr fcc-list))))
- --- 306,338 ----
- ;; File is present in a buffer => append to that buffer.
- (let ((curbuf (current-buffer))
- (beg (point-min)) (end (point-max)))
- ! (set-buffer buffer)
- ! (if (eq major-mode 'rmail-mode)
- ! ;; buffer is in RMAIL mode - be clever with messages.
- ! (let ((buffer-read-only nil)
- ! (curmsg rmail-current-message))
- ! (widen)
- ! (narrow-to-region (point-max) (point-max))
- ! (insert-buffer-substring curbuf beg end)
- ! (rmail-convert-to-babyl-format)
- ! (goto-char (point-min))
- ! (widen)
- ! (search-backward "\^_")
- ! (narrow-to-region (point) (point-max))
- ! (goto-char (1+ (point-min)))
- ! (rmail-count-new-messages t)
- ! (rmail-show-message curmsg))
- ! ;; Else not in rmail-mode - tag message on at end.
- ! (if (or (not buffer-read-only)
- ! (y-or-n-p
- ! (format "Buffer %s is read-only. Append anyway? "
- ! (buffer-name buffer))))
- ! (let ((buffer-read-only nil))
- ! (save-excursion
- ! (save-restriction
- ! (goto-char (point-max))
- ! (insert-buffer-substring curbuf beg end))))
- ! )))
- ;; Else append to the file directly.
- (write-region (point-min) (point-max) (car fcc-list) t)))
- (setq fcc-list (cdr fcc-list))))
-
- -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip --
-