Mercurial > emacs
comparison lisp/mail/rmail.el @ 39298:2b67bb3275f8
(top-level): Require mule-utils when compiling.
(rmail-decode-babyl-format): Use detect-coding-with-priority
instead of detect-coding-region, to favor detection of emacs-mule
encoded Babyl files written by rmailout.el etc. Suggested by
Kenichi Handa <handa@etl.go.jp>.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 16 Sep 2001 07:55:19 +0000 |
parents | 253f761ad37b |
children | 19496cafe865 |
comparison
equal
deleted
inserted
replaced
39297:aff361cfdccb | 39298:2b67bb3275f8 |
---|---|
38 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix | 38 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix |
39 ;; variable, and a bury rmail buffer (wipe) command. | 39 ;; variable, and a bury rmail buffer (wipe) command. |
40 ;; | 40 ;; |
41 | 41 |
42 (require 'mail-utils) | 42 (require 'mail-utils) |
43 (eval-when-compile (require 'mule-util)) ; for detect-coding-with-priority | |
43 | 44 |
44 ; These variables now declared in paths.el. | 45 ; These variables now declared in paths.el. |
45 ;(defvar rmail-spool-directory "/usr/spool/mail/" | 46 ;(defvar rmail-spool-directory "/usr/spool/mail/" |
46 ; "This is the name of the directory used by the system mailer for\n\ | 47 ; "This is the name of the directory used by the system mailer for\n\ |
47 ;delivering new mail. Its name should end with a slash.") | 48 ;delivering new mail. Its name should end with a slash.") |
619 (interactive (if current-prefix-arg | 620 (interactive (if current-prefix-arg |
620 (list (read-file-name "Run rmail on RMAIL file: ")))) | 621 (list (read-file-name "Run rmail on RMAIL file: ")))) |
621 (rmail-require-mime-maybe) | 622 (rmail-require-mime-maybe) |
622 (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name))) | 623 (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name))) |
623 (existed (get-file-buffer file-name)) | 624 (existed (get-file-buffer file-name)) |
624 ;; This binding is necessary because we much decide if we | 625 ;; This binding is necessary because we must decide if we |
625 ;; need code conversion while the buffer is unibyte | 626 ;; need code conversion while the buffer is unibyte |
626 ;; (i.e. enable-multibyte-characters is nil). | 627 ;; (i.e. enable-multibyte-characters is nil). |
627 (rmail-enable-multibyte | 628 (rmail-enable-multibyte |
628 (if existed | 629 (if existed |
629 (with-current-buffer existed enable-multibyte-characters) | 630 (with-current-buffer existed enable-multibyte-characters) |
770 (goto-char (point-max)) | 771 (goto-char (point-max)) |
771 (search-backward "\n\^_" from 'mv) | 772 (search-backward "\n\^_" from 'mv) |
772 (setq to (point)) | 773 (setq to (point)) |
773 (unless (and coding-system | 774 (unless (and coding-system |
774 (coding-system-p coding-system)) | 775 (coding-system-p coding-system)) |
775 (setq coding-system (detect-coding-region from to t))) | 776 (setq coding-system |
777 ;; Emacs 21.1 and later writes RMAIL files in emacs-mule, but | |
778 ;; earlier versions did that with the current buffer's encoding. | |
779 ;; So we want to favor detection of emacs-mule (whose normal | |
780 ;; priority is quite low), but still allow detection of other | |
781 ;; encodings if emacs-mule won't fit. The call to | |
782 ;; detect-coding-with-priority below achieves that. | |
783 (car (detect-coding-with-priority | |
784 from to | |
785 '((coding-category-emacs-mule . emacs-mule)))))) | |
776 (unless (memq coding-system | 786 (unless (memq coding-system |
777 '(undecided undecided-unix)) | 787 '(undecided undecided-unix)) |
778 (set-buffer-modified-p t) ; avoid locking when decoding | 788 (set-buffer-modified-p t) ; avoid locking when decoding |
779 (decode-coding-region from to coding-system) | 789 (decode-coding-region from to coding-system) |
780 (setq coding-system last-coding-system-used)) | 790 (setq coding-system last-coding-system-used)) |