diff options
| -rw-r--r-- | lisp/mail/pmail.el | 74 |
1 files changed, 3 insertions, 71 deletions
diff --git a/lisp/mail/pmail.el b/lisp/mail/pmail.el index 7bf91f5838f..e40fd273097 100644 --- a/lisp/mail/pmail.el +++ b/lisp/mail/pmail.el | |||
| @@ -896,25 +896,6 @@ If `pmail-display-summary' is non-nil, make a summary for this PMAIL file." | |||
| 896 | (if run-mail-hook | 896 | (if run-mail-hook |
| 897 | (run-hooks 'pmail-mode-hook)))))) | 897 | (run-hooks 'pmail-mode-hook)))))) |
| 898 | 898 | ||
| 899 | ;; Given the value of MAILPATH, return a list of inbox file names. | ||
| 900 | ;; This is turned off because it is not clear that the user wants | ||
| 901 | ;; all these inboxes to feed into the primary pmail file. | ||
| 902 | ; (defun pmail-convert-mailpath (string) | ||
| 903 | ; (let (idx list) | ||
| 904 | ; (while (setq idx (string-match "[%:]" string)) | ||
| 905 | ; (let ((this (substring string 0 idx))) | ||
| 906 | ; (setq string (substring string (1+ idx))) | ||
| 907 | ; (setq list (cons (if (string-match "%" this) | ||
| 908 | ; (substring this 0 (string-match "%" this)) | ||
| 909 | ; this) | ||
| 910 | ; list)))) | ||
| 911 | ; list)) | ||
| 912 | |||
| 913 | ; I have checked that adding "-*- pmail -*-" to the BABYL OPTIONS line | ||
| 914 | ; will not cause emacs 18.55 problems. | ||
| 915 | |||
| 916 | ;; This calls pmail-decode-babyl-format if the file is already Babyl. | ||
| 917 | |||
| 918 | (defun pmail-convert-file-maybe () | 899 | (defun pmail-convert-file-maybe () |
| 919 | "Determine if the file needs to be converted to mbox format." | 900 | "Determine if the file needs to be converted to mbox format." |
| 920 | (widen) | 901 | (widen) |
| @@ -937,8 +918,7 @@ If `pmail-display-summary' is non-nil, make a summary for this PMAIL file." | |||
| 937 | (t (pmail-error-bad-format)))) | 918 | (t (pmail-error-bad-format)))) |
| 938 | 919 | ||
| 939 | (defun pmail-error-bad-format (&optional msgnum) | 920 | (defun pmail-error-bad-format (&optional msgnum) |
| 940 | "Report that the buffer contains a message that is not RFC2822 | 921 | "Report that the buffer is not in the mbox file format. |
| 941 | compliant. | ||
| 942 | MSGNUM, if present, indicates the malformed message." | 922 | MSGNUM, if present, indicates the malformed message." |
| 943 | (if msgnum | 923 | (if msgnum |
| 944 | (error "Message %s is not a valid RFC2822 message." msgnum) | 924 | (error "Message %s is not a valid RFC2822 message." msgnum) |
| @@ -967,20 +947,9 @@ This function also reinitializes local variables used by Pmail." | |||
| 967 | (delete-file old-file) | 947 | (delete-file old-file) |
| 968 | (delete-file new-file)))) | 948 | (delete-file new-file)))) |
| 969 | 949 | ||
| 970 | (defun pmail-insert-pmail-file-header () | ||
| 971 | (let ((buffer-read-only nil)) | ||
| 972 | ;; -*-pmail-*- is here so that visiting the file normally | ||
| 973 | ;; recognizes it as an Pmail file. | ||
| 974 | (insert "BABYL OPTIONS: -*- pmail -*- | ||
| 975 | Version: 5 | ||
| 976 | Labels: | ||
| 977 | Note: This is the header of an pmail file. | ||
| 978 | Note: If you are seeing it in pmail, | ||
| 979 | Note: it means the file has no messages in it.\n\^_"))) | ||
| 980 | |||
| 981 | (defun pmail-get-coding-system () | 950 | (defun pmail-get-coding-system () |
| 982 | "Return a suitable coding system to use for the mail message in | 951 | "Return a suitable coding system to use for the current mail message. |
| 983 | the region." | 952 | The buffer is expected to be narrowed to just the header of the message." |
| 984 | (let ((content-type-header (mail-fetch-field "content-type")) | 953 | (let ((content-type-header (mail-fetch-field "content-type")) |
| 985 | separator) | 954 | separator) |
| 986 | (save-excursion | 955 | (save-excursion |
| @@ -990,43 +959,6 @@ the region." | |||
| 990 | (substring content-type-header (match-beginning 1) (match-end 1)) | 959 | (substring content-type-header (match-beginning 1) (match-end 1)) |
| 991 | 'undecided))) | 960 | 'undecided))) |
| 992 | 961 | ||
| 993 | ;; Decode Babyl formatted part at the head of current buffer by | ||
| 994 | ;; pmail-file-coding-system, or if it is nil, do auto conversion. | ||
| 995 | |||
| 996 | (defun pmail-decode-babyl-format () | ||
| 997 | (let ((modifiedp (buffer-modified-p)) | ||
| 998 | (buffer-read-only nil) | ||
| 999 | (coding-system pmail-file-coding-system) | ||
| 1000 | from to) | ||
| 1001 | (goto-char (point-min)) | ||
| 1002 | (search-forward "\n\^_" nil t) ; Skip BABYL header. | ||
| 1003 | (setq from (point)) | ||
| 1004 | (goto-char (point-max)) | ||
| 1005 | (search-backward "\n\^_" from 'mv) | ||
| 1006 | (setq to (point)) | ||
| 1007 | (unless (and coding-system | ||
| 1008 | (coding-system-p coding-system)) | ||
| 1009 | (setq coding-system | ||
| 1010 | ;; If pmail-file-coding-system is nil, Emacs 21 writes | ||
| 1011 | ;; PMAIL files in emacs-mule, Emacs 22 in utf-8, but | ||
| 1012 | ;; earlier versions did that with the current buffer's | ||
| 1013 | ;; encoding. So we want to favor detection of emacs-mule | ||
| 1014 | ;; (whose normal priority is quite low) and utf-8, but | ||
| 1015 | ;; still allow detection of other encodings if they won't | ||
| 1016 | ;; fit. The call to with-coding-priority below achieves | ||
| 1017 | ;; that. | ||
| 1018 | (with-coding-priority '(emacs-mule utf-8) | ||
| 1019 | (detect-coding-region from to 'highest)))) | ||
| 1020 | (unless (eq (coding-system-type coding-system) 'undecided) | ||
| 1021 | (set-buffer-modified-p t) ; avoid locking when decoding | ||
| 1022 | (let ((buffer-undo-list t)) | ||
| 1023 | (decode-coding-region from to coding-system)) | ||
| 1024 | (setq coding-system last-coding-system-used)) | ||
| 1025 | (set-buffer-modified-p modifiedp) | ||
| 1026 | (setq buffer-file-coding-system nil) | ||
| 1027 | (setq save-buffer-coding-system | ||
| 1028 | (or coding-system 'undecided)))) | ||
| 1029 | |||
| 1030 | (defvar pmail-mode-map nil) | 962 | (defvar pmail-mode-map nil) |
| 1031 | (if pmail-mode-map | 963 | (if pmail-mode-map |
| 1032 | nil | 964 | nil |