diff options
| author | Richard M. Stallman | 1999-01-28 03:13:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-01-28 03:13:51 +0000 |
| commit | aa2d5fe49c62cdf7591fc111ea9a9ca981bd91c4 (patch) | |
| tree | 6be6e62c09d7739aa9a7d167f58de46efbe3eace | |
| parent | 162308884ae1ee822f680921a07060aba9ca781c (diff) | |
| download | emacs-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.el | 36 |
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. |
| 359 | When starting Rmail, if `rmail-enable-mime' is non-nil, | 359 | When starting Rmail, if `rmail-enable-mime' is non-nil, |
| 360 | this feature is required with `require'.") | 360 | this 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. | ||
| 365 | If this variable is nil, or the message has not MIME specification, | ||
| 366 | the message is decoded as normal way. | ||
| 367 | |||
| 368 | If the variable `rmail-enable-mime' is non-nil, this variables is | ||
| 369 | ignored, and all the decoding work is done by a feature specified by | ||
| 370 | the 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. | ||
| 376 | The 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) |