diff options
| author | Lars Ingebrigtsen | 2019-07-12 15:38:34 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-12 15:38:34 +0200 |
| commit | c281b9a121a251b19e3e90b67ca85fbe834b3bc2 (patch) | |
| tree | 82c38c6a4471257c19a871cf6b5ac197cc812fd5 | |
| parent | 812715a471c8854359733b11aec53fc31f56648f (diff) | |
| download | emacs-c281b9a121a251b19e3e90b67ca85fbe834b3bc2.tar.gz emacs-c281b9a121a251b19e3e90b67ca85fbe834b3bc2.zip | |
Add comments to rfc2047
* lisp/mail/rfc2047.el (rfc2047-fold-region): Add comments to the
function.
| -rw-r--r-- | lisp/mail/rfc2047.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el index 118ca8a4c9b..5f2abc435d1 100644 --- a/lisp/mail/rfc2047.el +++ b/lisp/mail/rfc2047.el | |||
| @@ -741,6 +741,8 @@ Point moves to the end of the region." | |||
| 741 | (while (not (eobp)) | 741 | (while (not (eobp)) |
| 742 | (when (and (or break qword-break) | 742 | (when (and (or break qword-break) |
| 743 | (> (- (point) bol) 76)) | 743 | (> (- (point) bol) 76)) |
| 744 | ;; We have a line longer than 76 characters, so break the | ||
| 745 | ;; line. | ||
| 744 | (goto-char (or break qword-break)) | 746 | (goto-char (or break qword-break)) |
| 745 | (setq break nil | 747 | (setq break nil |
| 746 | qword-break nil) | 748 | qword-break nil) |
| @@ -753,7 +755,10 @@ Point moves to the end of the region." | |||
| 753 | (skip-chars-forward " \t") | 755 | (skip-chars-forward " \t") |
| 754 | (unless (eobp) | 756 | (unless (eobp) |
| 755 | (forward-char 1))) | 757 | (forward-char 1))) |
| 758 | ;; See whether we're at a point where we can break the line | ||
| 759 | ;; (if it turns out to be too long). | ||
| 756 | (cond | 760 | (cond |
| 761 | ;; New line, so there's nothing to break. | ||
| 757 | ((eq (char-after) ?\n) | 762 | ((eq (char-after) ?\n) |
| 758 | (forward-char 1) | 763 | (forward-char 1) |
| 759 | (setq bol (point) | 764 | (setq bol (point) |
| @@ -762,12 +767,17 @@ Point moves to the end of the region." | |||
| 762 | (skip-chars-forward " \t") | 767 | (skip-chars-forward " \t") |
| 763 | (unless (or (eobp) (eq (char-after) ?\n)) | 768 | (unless (or (eobp) (eq (char-after) ?\n)) |
| 764 | (forward-char 1))) | 769 | (forward-char 1))) |
| 770 | ;; CR in CRLF; shouldn't really as this function shouldn't be | ||
| 771 | ;; called after encoding for line transmission. | ||
| 765 | ((eq (char-after) ?\r) | 772 | ((eq (char-after) ?\r) |
| 766 | (forward-char 1)) | 773 | (forward-char 1)) |
| 774 | ;; Whitespace -- possible break point. | ||
| 767 | ((memq (char-after) '(? ?\t)) | 775 | ((memq (char-after) '(? ?\t)) |
| 768 | (skip-chars-forward " \t") | 776 | (skip-chars-forward " \t") |
| 769 | (unless first ;; Don't break just after the header name. | 777 | (unless first ;; Don't break just after the header name. |
| 770 | (setq break (point)))) | 778 | (setq break (point)))) |
| 779 | ;; If the header has been encoded (with RFC2047 encoding, | ||
| 780 | ;; which looks like "=?utf-8?Q?F=C3=B3?=". | ||
| 771 | ((not break) | 781 | ((not break) |
| 772 | (if (not (looking-at "=\\?[^=]")) | 782 | (if (not (looking-at "=\\?[^=]")) |
| 773 | (if (eq (char-after) ?=) | 783 | (if (eq (char-after) ?=) |
| @@ -777,9 +787,12 @@ Point moves to the end of the region." | |||
| 777 | (unless (= (point) b) | 787 | (unless (= (point) b) |
| 778 | (setq qword-break (point))) | 788 | (setq qword-break (point))) |
| 779 | (skip-chars-forward "^ \t\n\r"))) | 789 | (skip-chars-forward "^ \t\n\r"))) |
| 790 | ;; Look for the next LWSP (i.e., whitespace character). | ||
| 780 | (t | 791 | (t |
| 781 | (skip-chars-forward "^ \t\n\r"))) | 792 | (skip-chars-forward "^ \t\n\r"))) |
| 782 | (setq first nil)) | 793 | (setq first nil)) |
| 794 | ;; Finally, after the loop, we have a line longer than 76 | ||
| 795 | ;; characters, so break the line. | ||
| 783 | (when (and (or break qword-break) | 796 | (when (and (or break qword-break) |
| 784 | (> (- (point) bol) 76)) | 797 | (> (- (point) bol) 76)) |
| 785 | (goto-char (or break qword-break)) | 798 | (goto-char (or break qword-break)) |