(rmail-hex-string-to-integer): Likewise.
(rmail-hex-char-to-integer): Likewise.
(rmail-decode-mail-file): Renamed from `rmail-decode-mbox-file'.
+ (rmail-delete-inbox-files): New function factored out of
+ `rmail-get-new-mail'.
+ (rmail-get-new-mail): Use it.
+ (rmail-get-inbox-files): Renamed from `rmail-get-inbox-list'.
2006-01-21 Alex Schroeder <alex@gnu.org>
\f
;;;; *** Rmail input ***
-(defun rmail-get-inbox-list ()
+(defun rmail-get-inbox-files ()
"Return all files from `rmail-inbox-list' without name conflicts.
A conflict happens when two inbox file names have the same name
according to `file-name-nondirectory'."
(push (file-name-nondirectory file) last-names)))
(nreverse files)))
+(defun rmail-delete-inbox-files (files)
+ "Delete all files given in FILES.
+If delete fails, truncate them to zero length."
+ (dolist (file files)
+ (condition-case nil
+ ;; First, try deleting.
+ (condition-case nil
+ (delete-file file)
+ ;; If we can't delete it, truncate it.
+ (file-error (write-region (point) (point) file)))
+ (file-error nil))))
+
(defun rmail-get-new-mail (&optional file-name)
"Move any new mail from this mail file's inbox files.
The inbox files for the primary mail file are determined using
;; Get rid of all undo records for this buffer.
(unless (eq buffer-undo-list t)
(setq buffer-undo-list nil))
- (let ((files (if file-name (list file-name) (rmail-get-inbox-list)))
+ (let ((files (if file-name (list file-name) (rmail-get-inbox-files)))
(rmail-enable-multibyte (default-value 'enable-multibyte-characters))
found current-message)
(condition-case nil
(if file-name
(rmail-insert-inbox-text files nil)
(setq delete-files (rmail-insert-inbox-text files t)))
+ ;; Process newly found messages and save them into the
+ ;; RMAIL file.
(unless (equal (point-min) (point-max))
(setq new-messages (rmail-process-new-messages)
rmail-current-message (1+ rmail-total-messages)
(save-buffer))
;; Delete the old files, now that the RMAIL file is
;; saved.
- (dolist (i delete-files)
- (condition-case nil
- ;; First, try deleting.
- (condition-case nil
- (delete-file i)
- ;; If we can't delete it, truncate it.
- (file-error (write-region (point) (point) i)))
- (file-error nil)))))
+ (rmail-delete-inbox-files delete-files)))
(if (= new-messages 0)
(progn (goto-char opoint)
(when (or file-name rmail-inbox-list)