emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master c281b9a 1/3: Add comments to rfc2047


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master c281b9a 1/3: Add comments to rfc2047
Date: Fri, 12 Jul 2019 09:59:48 -0400 (EDT)

branch: master
commit c281b9a121a251b19e3e90b67ca85fbe834b3bc2
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Add comments to rfc2047
    
    * lisp/mail/rfc2047.el (rfc2047-fold-region): Add comments to the
    function.
---
 lisp/mail/rfc2047.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el
index 118ca8a..5f2abc4 100644
--- a/lisp/mail/rfc2047.el
+++ b/lisp/mail/rfc2047.el
@@ -741,6 +741,8 @@ Point moves to the end of the region."
       (while (not (eobp))
        (when (and (or break qword-break)
                   (> (- (point) bol) 76))
+          ;; We have a line longer than 76 characters, so break the
+          ;; line.
          (goto-char (or break qword-break))
          (setq break nil
                qword-break nil)
@@ -753,7 +755,10 @@ Point moves to the end of the region."
          (skip-chars-forward " \t")
          (unless (eobp)
            (forward-char 1)))
+        ;; See whether we're at a point where we can break the line
+        ;; (if it turns out to be too long).
        (cond
+         ;; New line, so there's nothing to break.
         ((eq (char-after) ?\n)
          (forward-char 1)
          (setq bol (point)
@@ -762,12 +767,17 @@ Point moves to the end of the region."
          (skip-chars-forward " \t")
          (unless (or (eobp) (eq (char-after) ?\n))
            (forward-char 1)))
+         ;; CR in CRLF; shouldn't really as this function shouldn't be
+         ;; called after encoding for line transmission.
         ((eq (char-after) ?\r)
          (forward-char 1))
+         ;; Whitespace -- possible break point.
         ((memq (char-after) '(?  ?\t))
          (skip-chars-forward " \t")
          (unless first ;; Don't break just after the header name.
            (setq break (point))))
+         ;; If the header has been encoded (with RFC2047 encoding,
+         ;; which looks like "=?utf-8?Q?F=C3=B3?=".
         ((not break)
          (if (not (looking-at "=\\?[^=]"))
              (if (eq (char-after) ?=)
@@ -777,9 +787,12 @@ Point moves to the end of the region."
            (unless (= (point) b)
              (setq qword-break (point)))
            (skip-chars-forward "^ \t\n\r")))
+         ;; Look for the next LWSP (i.e., whitespace character).
         (t
          (skip-chars-forward "^ \t\n\r")))
        (setq first nil))
+      ;; Finally, after the loop, we have a line longer than 76
+      ;; characters, so break the line.
       (when (and (or break qword-break)
                 (> (- (point) bol) 76))
        (goto-char (or break qword-break))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]