aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1999-01-28 03:13:51 +0000
committerRichard M. Stallman1999-01-28 03:13:51 +0000
commitaa2d5fe49c62cdf7591fc111ea9a9ca981bd91c4 (patch)
tree6be6e62c09d7739aa9a7d167f58de46efbe3eace
parent162308884ae1ee822f680921a07060aba9ca781c (diff)
downloademacs-aa2d5fe49c62cdf7591fc111ea9a9ca981bd91c4.tar.gz
emacs-aa2d5fe49c62cdf7591fc111ea9a9ca981bd91c4.zip
(rmail-decode-mime-charset): New variable.
(rmail-mime-charset-pattern): New variable. (rmail-convert-to-babyl-format): Decode by MIME-charset if rmail-decode-mime-charset is non-nil.
-rw-r--r--lisp/mail/rmail.el36
1 files changed, 35 insertions, 1 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index f9f092f8679..6384db9e71e 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -358,6 +358,23 @@ until a user explicitly requires it."
358 "Feature to require to load MIME support in Rmail. 358 "Feature to require to load MIME support in Rmail.
359When starting Rmail, if `rmail-enable-mime' is non-nil, 359When starting Rmail, if `rmail-enable-mime' is non-nil,
360this feature is required with `require'.") 360this feature is required with `require'.")
361
362;;;###autoload
363(defvar rmail-decode-mime-charset t
364 "*Non-nil means a message is decoded by MIME's charset specification.
365If this variable is nil, or the message has not MIME specification,
366the message is decoded as normal way.
367
368If the variable `rmail-enable-mime' is non-nil, this variables is
369ignored, and all the decoding work is done by a feature specified by
370the variable `rmail-mime-feature'.")
371
372;;;###autoload
373(defvar rmail-mime-charset-pattern
374 "^content-type:[ ]*text/plain;[ ]*charset=\\([^ \t\n]+\\)"
375 "Regexp to match MIME-charset specification in a header of message.
376The first parenthesized expression should match the MIME-charset name.")
377
361 378
362;;; Regexp matching the delimiter of messages in UNIX mail format 379;;; Regexp matching the delimiter of messages in UNIX mail format
363;;; (UNIX From lines), minus the initial ^. Note that if you change 380;;; (UNIX From lines), minus the initial ^. Note that if you change
@@ -1448,6 +1465,13 @@ Optional DEFAULT is password to start with."
1448 (message nil) 1465 (message nil)
1449 pass)) 1466 pass))
1450 1467
1468;; Decode the region specified by FROM and TO by CODING.
1469;; If CODING is nil or an invalid coding system, decode by `undecided'.
1470(defun rmail-decode-region (from to coding)
1471 (if (or (not coding) (not (coding-system-p coding)))
1472 (setq coding 'undecided))
1473 (decode-coding-region from to coding))
1474
1451;; the rmail-break-forwarded-messages feature is not implemented 1475;; the rmail-break-forwarded-messages feature is not implemented
1452(defun rmail-convert-to-babyl-format () 1476(defun rmail-convert-to-babyl-format ()
1453 (let ((count 0) start 1477 (let ((count 0) start
@@ -1605,7 +1629,17 @@ Optional DEFAULT is password to start with."
1605 (setq last-coding-system-used nil) 1629 (setq last-coding-system-used nil)
1606 (or rmail-enable-mime 1630 (or rmail-enable-mime
1607 (not rmail-enable-multibyte) 1631 (not rmail-enable-multibyte)
1608 (decode-coding-region start (point) 'undecided)) 1632 (let ((mime-charset
1633 (if (and rmail-decode-mime-charset
1634 (save-excursion
1635 (goto-char start)
1636 (search-forward "\n\n" nil t)
1637 (let ((case-fold-search t))
1638 (re-search-backward
1639 rmail-mime-charset-pattern
1640 start t))))
1641 (intern (downcase (match-string 1))))))
1642 (rmail-decode-region start (point) mime-charset)))
1609 (save-excursion 1643 (save-excursion
1610 (goto-char start) 1644 (goto-char start)
1611 (forward-line 3) 1645 (forward-line 3)