comparison lisp/mail/rmail.el @ 17762:dfefaeb20c75

(rmail-enable-decoding-message): New variable. (rmail-convert-file): Comment fixed. (rmail-revert): Do not decode RMAIL file again because the backup file is saved in Emacs internal format. (rmail-convert-to-babyl-format): Check rmail-enable-decoding-message.
author Kenichi Handa <handa@m17n.org>
date Mon, 12 May 1997 06:56:27 +0000
parents b85205cfba13
children c0422adc1b0e
comparison
equal deleted inserted replaced
17761:c5f430853301 17762:dfefaeb20c75
387 ;;;###autoload 387 ;;;###autoload
388 (defvar rmail-file-coding-system nil 388 (defvar rmail-file-coding-system nil
389 "Coding system used in RMAIL file. 389 "Coding system used in RMAIL file.
390 390
391 This is set to nil by default.") 391 This is set to nil by default.")
392
393 ;;;###autoload
394 (defvar rmail-enable-decoding-message nil
395 "*If non-nil, RMAIL decode character code of incomming mails automatically.
396 The default value is nil.
397
398 Regardless of the value of this variable, MIME messages are decoded
399 if rmail-enable-mime is non-nil.")
392 400
393 ;;;###autoload 401 ;;;###autoload
394 (defcustom rmail-enable-mime nil 402 (defcustom rmail-enable-mime nil
395 "*If non-nil, RMAIL uses MIME feature. 403 "*If non-nil, RMAIL uses MIME feature.
396 If the value is t, RMAIL automatically shows MIME decoded message. 404 If the value is t, RMAIL automatically shows MIME decoded message.
515 (setq convert t) 523 (setq convert t)
516 (rmail-insert-rmail-file-header))) 524 (rmail-insert-rmail-file-header)))
517 (if (and (not convert) 525 (if (and (not convert)
518 (not rmail-enable-mime) 526 (not rmail-enable-mime)
519 rmail-file-coding-system) 527 rmail-file-coding-system)
520 ;; Decode BABYL part at the headq only. The remaining non 528 ;; Decode coding system of BABYL part at the head only. The
521 ;; BABYL parts are decode in rmail-convert-to-babyl-format if 529 ;; remaining non BABYL parts are decoded in
522 ;; necessary.. 530 ;; rmail-convert-to-babyl-format if necessary.
523 (rmail-decode-babyl-format)) 531 (rmail-decode-babyl-format))
524 ;; If file was not a Babyl file or if there are 532 ;; If file was not a Babyl file or if there are
525 ;; Unix format messages added at the end, 533 ;; Unix format messages added at the end,
526 ;; convert file as necessary. 534 ;; convert file as necessary.
527 (if (or convert 535 (if (or convert
883 (let ((revert-buffer-function (default-value 'revert-buffer-function))) 891 (let ((revert-buffer-function (default-value 'revert-buffer-function)))
884 ;; Call our caller again, but this time it does the default thing. 892 ;; Call our caller again, but this time it does the default thing.
885 (if (revert-buffer arg noconfirm) 893 (if (revert-buffer arg noconfirm)
886 ;; If the user said "yes", and we changed something, 894 ;; If the user said "yes", and we changed something,
887 ;; reparse the messages. 895 ;; reparse the messages.
888 (progn 896 ;; But, we don't have to convert coding system because backup
897 ;; files should have been saved by Emacs' internal format.
898 (let ((rmail-file-coding-system nil)
899 (rmail-enable-decoding-message nil))
889 (rmail-convert-file) 900 (rmail-convert-file)
890 (goto-char (point-max)) 901 (goto-char (point-max))
891 (rmail-mode))))) 902 (rmail-mode)))))
892 903
893 ;; Return a list of files from this buffer's Mail: option. 904 ;; Return a list of files from this buffer's Mail: option.
1387 (narrow-to-region start (1- (point))) 1398 (narrow-to-region start (1- (point)))
1388 (goto-char (point-min)) 1399 (goto-char (point-min))
1389 (while (search-forward "\n\^_" nil t); single char "\^_" 1400 (while (search-forward "\n\^_" nil t); single char "\^_"
1390 (replace-match "\n^_")))); 2 chars: "^" and "_" 1401 (replace-match "\n^_")))); 2 chars: "^" and "_"
1391 (or rmail-enable-mime 1402 (or rmail-enable-mime
1392 (not rmail-file-coding-system) 1403 (not rmail-enable-decoding-message)
1393 (decode-coding-region start (point) 'automatic-conversion)) 1404 (decode-coding-region start (point) 'automatic-conversion))
1394 (narrow-to-region (point) (point-max)) 1405 (narrow-to-region (point) (point-max))
1395 (setq count (1+ count))) 1406 (setq count (1+ count)))
1396 ;;*** Mail format 1407 ;;*** Mail format
1397 ((looking-at "^From ") 1408 ((looking-at "^From ")
1450 (goto-char (point-min)) 1461 (goto-char (point-min))
1451 (while (search-forward "\n\^_" nil t); single char 1462 (while (search-forward "\n\^_" nil t); single char
1452 (replace-match "\n^_")))); 2 chars: "^" and "_" 1463 (replace-match "\n^_")))); 2 chars: "^" and "_"
1453 (insert ?\^_) 1464 (insert ?\^_)
1454 (or rmail-enable-mime 1465 (or rmail-enable-mime
1455 (not rmail-file-coding-system) 1466 (not rmail-enable-decoding-message)
1456 (decode-coding-region start (point) 'automatic-conversion)) 1467 (decode-coding-region start (point) 'automatic-conversion))
1457 (narrow-to-region (point) (point-max))) 1468 (narrow-to-region (point) (point-max)))
1458 ;; 1469 ;;
1459 ;; This kludge is because some versions of sendmail.el 1470 ;; This kludge is because some versions of sendmail.el
1460 ;; insert an extra newline at the beginning that shouldn't 1471 ;; insert an extra newline at the beginning that shouldn't