comparison lisp/mail/pmail.el @ 100255:173f33792438

(pmail-convert-babyl-to-mbox): Reinitialize pmail-mode variables after conversion.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 05 Dec 2008 20:43:18 +0000
parents eb0db38d20d1
children eb90f68074a8
comparison
equal deleted inserted replaced
100254:6096a270eba8 100255:173f33792438
943 (if msgnum 943 (if msgnum
944 (error "Message %s is not a valid RFC2822 message." msgnum) 944 (error "Message %s is not a valid RFC2822 message." msgnum)
945 (error "Invalid mbox format mail file."))) 945 (error "Invalid mbox format mail file.")))
946 946
947 (defun pmail-convert-babyl-to-mbox () 947 (defun pmail-convert-babyl-to-mbox ()
948 "Convert the mail file from Babyl version 5 to mbox." 948 "Convert the mail file from Babyl version 5 to mbox.
949 This function also reinitializes local variables used by Pmail."
949 (let ((old-file (make-temp-file "pmail")) 950 (let ((old-file (make-temp-file "pmail"))
950 (new-file (make-temp-file "pmail"))) 951 (new-file (make-temp-file "pmail")))
951 (unwind-protect 952 (unwind-protect
952 (progn 953 (progn
954 (kill-all-local-variables)
953 (write-region (point-min) (point-max) old-file) 955 (write-region (point-min) (point-max) old-file)
954 (unrmail old-file new-file) 956 (unrmail old-file new-file)
957 (unrmail old-file "/home/cyd/pmail-test")
955 (message "Replacing BABYL format with mbox format...") 958 (message "Replacing BABYL format with mbox format...")
956 (let ((inhibit-read-only t)) 959 (let ((inhibit-read-only t))
957 (erase-buffer) 960 (erase-buffer)
958 (insert-file-contents-literally new-file) 961 (insert-file-contents-literally new-file)
962 (pmail-mode-1)
963 (pmail-perm-variables)
964 (pmail-variables)
959 (goto-char (point-max)) 965 (goto-char (point-max))
960 (pmail-set-message-counters)) 966 (pmail-set-message-counters))
961 (message "Replacing BABYL format with mbox format...done")) 967 (message "Replacing BABYL format with mbox format...done"))
962 (delete-file old-file) 968 (delete-file old-file)
963 (delete-file new-file)))) 969 (delete-file new-file))))