comparison lisp/mail/rmailout.el @ 3832:ea6739f778a5

(rmail-output): Check file can be read before trying to read part of it.
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Jun 1993 01:23:59 +0000
parents 02c40620b4de
children 419e92a78e6f
comparison
equal deleted inserted replaced
3831:9d48091cd976 3832:ea6739f778a5
160 (set-buffer tembuf) 160 (set-buffer tembuf)
161 (erase-buffer) 161 (erase-buffer)
162 ;; If we can do it, read a little of the file 162 ;; If we can do it, read a little of the file
163 ;; to check whether it is an RMAIL file. 163 ;; to check whether it is an RMAIL file.
164 ;; If it is, don't mess it up. 164 ;; If it is, don't mess it up.
165 (insert-file-contents file-name nil 0 20) 165 (and (file-readable-p file-name)
166 (if (looking-at "BABYL OPTIONS:\n") 166 (progn (insert-file-contents file-name nil 0 20)
167 (error (save-excursion 167 (looking-at "BABYL OPTIONS:\n"))
168 (set-buffer rmailbuf) 168 (error (save-excursion
169 (substitute-command-keys 169 (set-buffer rmailbuf)
170 "Use \\[rmail-output-to-rmail-file] to output to Rmail file `%s'")) 170 (substitute-command-keys
171 (file-name-nondirectory file-name))) 171 "Use \\[rmail-output-to-rmail-file] to output to Rmail file `%s'"))
172 (file-name-nondirectory file-name)))
172 (erase-buffer) 173 (erase-buffer)
173 (insert-buffer-substring rmailbuf) 174 (insert-buffer-substring rmailbuf)
174 (insert "\n") 175 (insert "\n")
175 (goto-char (point-min)) 176 (goto-char (point-min))
176 (insert "From " 177 (insert "From "