Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!idt.unit.no!he From: he@idt.unit.no Newsgroups: gnu.emacs.bug Subject: Bug in sendmail.el:mail-do-fcc Message-ID: <8905221924.AA09592@garm> Date: 22 May 89 19:24:16 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 48 In GNU Emacs 18.52.5 of Fri Mar 17 1989 on sigyn (berkeley-unix): When mail-do-fcc is processed, and there is a buffer corresponding to the fcc'd file, output to that buffer will fail with a "Buffer xxx is read-only" error message. Also, the code in 18.52 inserts the contents of the message being sent just after (point-max) in the fcc'd buffer. Since this buffer usually is in RMAIL mode (?), a restriction on the buffer is in place, and there is a fair chance you will see the fcc'd message appear as part of the current message of the fcc'd buffer later on. I think the fcc'd message should be appended at the end of the buffer, and appear as a separate message (of course). The enclosed diff fixes that problem, as well as the buffer-read-only problem. By the way, sendmail.el does not seem to have changed between 18.52 and 18.54, so it should drop in easily on the later versions as well. diff -c2 /local/emacs/lisp/sendmail.el sendmail.el *** /local/emacs/lisp/sendmail.el Sat Oct 8 18:09:58 1988 --- sendmail.el Mon May 22 20:29:05 1989 *************** *** 294,299 **** (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))) --- 294,303 ---- (save-excursion (set-buffer buffer) ! (let ((buffer-read-only nil) ! (beg2 (point-min)) (end2 (point-max))) ! (widen) ! (goto-char (point-max)) ! (insert-buffer-substring curbuf beg end) ! (narrow-to-region beg2 end2)))) ;; Else append to the file directly. (write-region (point-min) (point-max) (car fcc-list) t))) The (widen) ... (narrow-to-region...) crock is used instead of (save-restriction), due to the warnings in the doc string for that function. It would have been more elegant had (save-restriction) been sufficient (I haven't tried this). Haavard Eidnes, Division of Computer Systems and Telematics he@idt.unit.no Norwegian Institute of Technology