2454 |
(or (eq major-mode 'rmail-mode) |
(or (eq major-mode 'rmail-mode) |
2455 |
(switch-to-buffer rmail-buffer)) |
(switch-to-buffer rmail-buffer)) |
2456 |
(save-excursion |
(save-excursion |
2457 |
(unwind-protect |
(let ((pruned (rmail-msg-is-pruned))) |
2458 |
(let ((msgbeg (rmail-msgbeg rmail-current-message)) |
(unwind-protect |
2459 |
(msgend (rmail-msgend rmail-current-message)) |
(let ((msgbeg (rmail-msgbeg rmail-current-message)) |
2460 |
x-coding-header) |
(msgend (rmail-msgend rmail-current-message)) |
2461 |
(narrow-to-region msgbeg msgend) |
x-coding-header) |
2462 |
(goto-char (point-min)) |
;; We need the message headers pruned (we later restore |
2463 |
(when (search-forward "\n*** EOOH ***\n" (point-max) t) |
;; the pruned stat to what it was, see the end of |
2464 |
(narrow-to-region msgbeg (point))) |
;; unwind-protect form). |
2465 |
(goto-char (point-min)) |
(or pruned |
2466 |
(if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t) |
(rmail-toggle-header 1)) |
2467 |
(let ((old-coding (intern (match-string 1))) |
(narrow-to-region msgbeg msgend) |
2468 |
(buffer-read-only nil)) |
(goto-char (point-min)) |
2469 |
(check-coding-system old-coding) |
(when (search-forward "\n*** EOOH ***\n" (point-max) t) |
2470 |
;; Make sure the new coding system uses the same EOL |
(narrow-to-region msgbeg (point))) |
2471 |
;; conversion, to prevent ^M characters from popping |
(goto-char (point-min)) |
2472 |
;; up all over the place. |
(if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t) |
2473 |
(setq coding |
(let ((old-coding (intern (match-string 1))) |
2474 |
(coding-system-change-eol-conversion |
(buffer-read-only nil)) |
2475 |
coding |
(check-coding-system old-coding) |
2476 |
(coding-system-eol-type old-coding))) |
;; Make sure the new coding system uses the same EOL |
2477 |
(setq x-coding-header (point-marker)) |
;; conversion, to prevent ^M characters from popping |
2478 |
(narrow-to-region msgbeg msgend) |
;; up all over the place. |
2479 |
(encode-coding-region (point) msgend old-coding) |
(setq coding |
2480 |
(decode-coding-region (point) msgend coding) |
(coding-system-change-eol-conversion |
2481 |
(setq last-coding-system-used coding) |
coding |
2482 |
;; Rewrite the coding-system header according |
(coding-system-eol-type old-coding))) |
2483 |
;; to what we did. |
(setq x-coding-header (point-marker)) |
2484 |
(goto-char x-coding-header) |
(narrow-to-region msgbeg msgend) |
2485 |
(delete-region (point) |
(encode-coding-region (point) msgend old-coding) |
2486 |
(save-excursion |
(decode-coding-region (point) msgend coding) |
2487 |
(beginning-of-line) |
(setq last-coding-system-used coding) |
2488 |
(point))) |
;; Rewrite the coding-system header according |
2489 |
(insert "X-Coding-System: " |
;; to what we did. |
2490 |
(symbol-name last-coding-system-used)) |
(goto-char x-coding-header) |
2491 |
(set-marker x-coding-header nil) |
(delete-region (point) |
2492 |
(rmail-show-message)) |
(save-excursion |
2493 |
(error "No X-Coding-System header found"))))))) |
(beginning-of-line) |
2494 |
|
(point))) |
2495 |
|
(insert "X-Coding-System: " |
2496 |
|
(symbol-name last-coding-system-used)) |
2497 |
|
(set-marker x-coding-header nil) |
2498 |
|
(rmail-show-message)) |
2499 |
|
(error "No X-Coding-System header found"))) |
2500 |
|
(or pruned |
2501 |
|
(rmail-toggle-header 0))))))) |
2502 |
|
|
2503 |
;; Find all occurrences of certain fields, and highlight them. |
;; Find all occurrences of certain fields, and highlight them. |
2504 |
(defun rmail-highlight-headers () |
(defun rmail-highlight-headers () |