diff options
| author | Dave Love | 2003-05-07 17:27:31 +0000 |
|---|---|---|
| committer | Dave Love | 2003-05-07 17:27:31 +0000 |
| commit | c6e26ce2e466e93739d2ba3917d15ce7cadf26ea (patch) | |
| tree | 0a5ff94b6fe5b99064d95740b656e7b69b0a27c1 | |
| parent | be4d6a6fb6deae8b4abdf6f921a9835c7305c51f (diff) | |
| download | emacs-c6e26ce2e466e93739d2ba3917d15ce7cadf26ea.tar.gz emacs-c6e26ce2e466e93739d2ba3917d15ce7cadf26ea.zip | |
(rfc2047-header-encoding-alist): Add Followup-To.
(rfc2047-encode-message-header): Fold when encoding not necessary.
(rfc2047-encode-region): Skip \n as whitespace.
(rfc2047-fold-region): Fix whitespace regexps. Don't break just
after the header name.
(rfc2047-unfold-region): Fix regexp and whitespace-skipping.
| -rw-r--r-- | lisp/gnus/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/gnus/rfc2047.el | 60 |
2 files changed, 47 insertions, 24 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 37a0479e317..7f1033786e4 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2003-05-07 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | [Partial sync with Gnus.] | ||
| 4 | |||
| 5 | * rfc2047.el (rfc2047-header-encoding-alist): Add Followup-To. | ||
| 6 | (rfc2047-encode-message-header): Fold when encoding not necessary. | ||
| 7 | (rfc2047-encode-region): Skip \n as whitespace. | ||
| 8 | (rfc2047-fold-region): Fix whitespace regexps. Don't break just | ||
| 9 | after the header name. | ||
| 10 | (rfc2047-unfold-region): Fix regexp and whitespace-skipping. | ||
| 11 | |||
| 1 | 2003-05-06 Jesper Harder <harder@ifa.au.dk> | 12 | 2003-05-06 Jesper Harder <harder@ifa.au.dk> |
| 2 | 13 | ||
| 3 | * gnus-cus.el (gnus-group-customize, gnus-score-parameters): Don't | 14 | * gnus-cus.el (gnus-group-customize, gnus-score-parameters): Don't |
diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el index d695f70e15c..fbe10012182 100644 --- a/lisp/gnus/rfc2047.el +++ b/lisp/gnus/rfc2047.el | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; rfc2047.el --- functions for encoding and decoding rfc2047 messages | 1 | ;;; rfc2047.el --- functions for encoding and decoding rfc2047 messages |
| 2 | ;; Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. | 2 | ;; Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> | 4 | ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 5 | ;; MORIOKA Tomohiko <morioka@jaist.ac.jp> | 5 | ;; MORIOKA Tomohiko <morioka@jaist.ac.jp> |
| @@ -39,7 +39,7 @@ | |||
| 39 | (autoload 'mm-body-7-or-8 "mm-bodies") | 39 | (autoload 'mm-body-7-or-8 "mm-bodies") |
| 40 | 40 | ||
| 41 | (defvar rfc2047-header-encoding-alist | 41 | (defvar rfc2047-header-encoding-alist |
| 42 | '(("Newsgroups" . nil) | 42 | '(("Newsgroups\\|Followup-To" . nil) |
| 43 | ("Message-ID" . nil) | 43 | ("Message-ID" . nil) |
| 44 | ("\\(Resent-\\)?\\(From\\|Cc\\|To\\|Bcc\\|Reply-To\\|Sender\\)" . | 44 | ("\\(Resent-\\)?\\(From\\|Cc\\|To\\|Bcc\\|Reply-To\\|Sender\\)" . |
| 45 | address-mime) | 45 | address-mime) |
| @@ -135,15 +135,25 @@ Should be called narrowed to the head of the message." | |||
| 135 | (save-restriction | 135 | (save-restriction |
| 136 | (rfc2047-narrow-to-field) | 136 | (rfc2047-narrow-to-field) |
| 137 | (if (not (rfc2047-encodable-p)) | 137 | (if (not (rfc2047-encodable-p)) |
| 138 | (if (and (eq (mm-body-7-or-8) '8bit) | 138 | (prog1 |
| 139 | (mm-multibyte-p) | 139 | (if (and (eq (mm-body-7-or-8) '8bit) |
| 140 | (mm-coding-system-p | 140 | (mm-multibyte-p) |
| 141 | (car message-posting-charset))) | 141 | (mm-coding-system-p |
| 142 | ;; 8 bit must be decoded. | 142 | (car message-posting-charset))) |
| 143 | ;; Is message-posting-charset a coding system? | 143 | ;; 8 bit must be decoded. |
| 144 | (mm-encode-coding-region | 144 | (mm-encode-coding-region |
| 145 | (point-min) (point-max) | 145 | (point-min) (point-max) |
| 146 | (car message-posting-charset))) | 146 | (mm-charset-to-coding-system |
| 147 | (car message-posting-charset)))) | ||
| 148 | ;; No encoding necessary, but folding is nice | ||
| 149 | (rfc2047-fold-region | ||
| 150 | (save-excursion | ||
| 151 | (goto-char (point-min)) | ||
| 152 | (skip-chars-forward "^:") | ||
| 153 | (when (looking-at ": ") | ||
| 154 | (forward-char 2)) | ||
| 155 | (point)) | ||
| 156 | (point-max))) | ||
| 147 | ;; We found something that may perhaps be encoded. | 157 | ;; We found something that may perhaps be encoded. |
| 148 | (setq method nil | 158 | (setq method nil |
| 149 | alist rfc2047-header-encoding-alist) | 159 | alist rfc2047-header-encoding-alist) |
| @@ -230,7 +240,7 @@ Dynamically bind `rfc2047-encoding-type' to change that." | |||
| 230 | (let ((start (point)) ; start of current token | 240 | (let ((start (point)) ; start of current token |
| 231 | end ; end of current token | 241 | end ; end of current token |
| 232 | ;; Whether there's an encoded word before the current | 242 | ;; Whether there's an encoded word before the current |
| 233 | ;; tpken, either immediately or separated by space. | 243 | ;; token, either immediately or separated by space. |
| 234 | last-encoded) | 244 | last-encoded) |
| 235 | (goto-char (point-min)) | 245 | (goto-char (point-min)) |
| 236 | (condition-case nil ; in case of unbalanced quotes | 246 | (condition-case nil ; in case of unbalanced quotes |
| @@ -240,7 +250,7 @@ Dynamically bind `rfc2047-encoding-type' to change that." | |||
| 240 | (while (not (eobp)) | 250 | (while (not (eobp)) |
| 241 | (setq start (point)) | 251 | (setq start (point)) |
| 242 | ;; Skip whitespace. | 252 | ;; Skip whitespace. |
| 243 | (unless (= 0 (skip-chars-forward " \t")) | 253 | (unless (= 0 (skip-chars-forward " \t\n")) |
| 244 | (setq start (point))) | 254 | (setq start (point))) |
| 245 | (cond | 255 | (cond |
| 246 | ((not (char-after))) ; eob | 256 | ((not (char-after))) ; eob |
| @@ -364,6 +374,7 @@ By default, the region is treated as containing addresses (see | |||
| 364 | (goto-char (point-min)) | 374 | (goto-char (point-min)) |
| 365 | (let ((break nil) | 375 | (let ((break nil) |
| 366 | (qword-break nil) | 376 | (qword-break nil) |
| 377 | (first t) | ||
| 367 | (bol (save-restriction | 378 | (bol (save-restriction |
| 368 | (widen) | 379 | (widen) |
| 369 | (mm-point-at-bol)))) | 380 | (mm-point-at-bol)))) |
| @@ -372,7 +383,7 @@ By default, the region is treated as containing addresses (see | |||
| 372 | (goto-char (or break qword-break)) | 383 | (goto-char (or break qword-break)) |
| 373 | (setq break nil | 384 | (setq break nil |
| 374 | qword-break nil) | 385 | qword-break nil) |
| 375 | (if (looking-at " \t") | 386 | (if (looking-at "[ \t]") |
| 376 | (insert ?\n) | 387 | (insert ?\n) |
| 377 | (insert "\n ")) | 388 | (insert "\n ")) |
| 378 | (setq bol (1- (point))) | 389 | (setq bol (1- (point))) |
| @@ -392,7 +403,10 @@ By default, the region is treated as containing addresses (see | |||
| 392 | (forward-char 1)) | 403 | (forward-char 1)) |
| 393 | ((memq (char-after) '(? ?\t)) | 404 | ((memq (char-after) '(? ?\t)) |
| 394 | (skip-chars-forward " \t") | 405 | (skip-chars-forward " \t") |
| 395 | (setq break (1- (point)))) | 406 | (if first |
| 407 | ;; Don't break just after the header name. | ||
| 408 | (setq first nil) | ||
| 409 | (setq break (1- (point))))) | ||
| 396 | ((not break) | 410 | ((not break) |
| 397 | (if (not (looking-at "=\\?[^=]")) | 411 | (if (not (looking-at "=\\?[^=]")) |
| 398 | (if (eq (char-after) ?=) | 412 | (if (eq (char-after) ?=) |
| @@ -406,7 +420,7 @@ By default, the region is treated as containing addresses (see | |||
| 406 | (goto-char (or break qword-break)) | 420 | (goto-char (or break qword-break)) |
| 407 | (setq break nil | 421 | (setq break nil |
| 408 | qword-break nil) | 422 | qword-break nil) |
| 409 | (if (looking-at " \t") | 423 | (if (looking-at "[ \t]") |
| 410 | (insert ?\n) | 424 | (insert ?\n) |
| 411 | (insert "\n ")) | 425 | (insert "\n ")) |
| 412 | (setq bol (1- (point))) | 426 | (setq bol (1- (point))) |
| @@ -426,14 +440,12 @@ By default, the region is treated as containing addresses (see | |||
| 426 | leading) | 440 | leading) |
| 427 | (forward-line 1) | 441 | (forward-line 1) |
| 428 | (while (not (eobp)) | 442 | (while (not (eobp)) |
| 429 | (looking-at "[ \t]*") | 443 | (if (and (looking-at "[ \t]") |
| 430 | (setq leading (- (match-end 0) (match-beginning 0))) | 444 | (< (- (mm-point-at-eol) bol) 76)) |
| 431 | (if (< (- (mm-point-at-eol) bol leading) 76) | 445 | (delete-region eol (progn |
| 432 | (progn | 446 | (goto-char eol) |
| 433 | (goto-char eol) | 447 | (skip-chars-forward "\r\n") |
| 434 | (delete-region eol (progn | 448 | (point))) |
| 435 | (skip-chars-forward "[ \t\n\r]+") | ||
| 436 | (1- (point))))) | ||
| 437 | (setq bol (mm-point-at-bol))) | 449 | (setq bol (mm-point-at-bol))) |
| 438 | (setq eol (mm-point-at-eol)) | 450 | (setq eol (mm-point-at-eol)) |
| 439 | (forward-line 1))))) | 451 | (forward-line 1))))) |