* mm-bodies.el (mm-long-lines-p): New function.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 29 Dec 2000 12:51:48 +0000 (12:51 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 29 Dec 2000 12:51:48 +0000 (12:51 +0000)
(mm-body-encoding): Use it.
(mm-body-encoding): Encode articles with lines longer than 1000
characters.

lisp/ChangeLog
lisp/gnus-art.el
lisp/mm-bodies.el
lisp/mml.el

index 6508913..f789721 100644 (file)
@@ -1,3 +1,10 @@
+2000-12-29 13:25:10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-bodies.el (mm-long-lines-p): New function.
+       (mm-body-encoding): Use it.
+       (mm-body-encoding): Encode articles with lines longer than 1000
+       characters. 
+
 2000-12-29 01:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * mm-util.el (mm-enable-multibyte): Use
index afb61ca..146ae90 100644 (file)
@@ -5358,11 +5358,10 @@ For example:
     (let ((gnus-mime-security-button-line-format 
           gnus-mime-security-button-end-line-format))
       (gnus-insert-mime-security-button handle))
-    (mm-set-handle-multipart-parameter handle 'gnus-region 
-                                      (cons (set-marker (make-marker)
-                                                        (point-min))
-                                            (set-marker (make-marker)
-                                                        (point-max))))))
+    (mm-set-handle-multipart-parameter
+     handle 'gnus-region 
+     (cons (set-marker (make-marker) (point-min))
+          (set-marker (make-marker) (point-max))))))
 
 (gnus-ems-redefine)
 
index 9983a8f..28d202e 100644 (file)
@@ -112,16 +112,32 @@ If no encoding was done, nil is returned."
              (setq start nil))
            charset)))))))
 
-(eval-when-compile (defvar message-posting-charset))
+(defun mm-long-lines-p (length)
+  "Say whether any of the lines in the buffer is longer than LINES."
+  (save-excursion
+    (goto-char (point-min))
+    (end-of-line)
+    (while (and (not (eobp))
+               (not (> (current-column) length)))
+      (forward-line 1)
+      (end-of-line))
+    (and (> (current-column) length)
+        (current-column))))
+
+(defvar message-posting-charset)
 
 (defun mm-body-encoding (charset &optional encoding)
   "Do Content-Transfer-Encoding and return the encoding of the current buffer."
-  (let ((bits (mm-body-7-or-8)))
+  (let ((bits (mm-body-7-or-8))
+       (longp (mm-long-lines-p 1000)))
     (require 'message)
     (cond
-     ((and (not mm-use-ultra-safe-encoding) (eq bits '7bit))
+     ((and (not mm-use-ultra-safe-encoding)
+          (not longp)
+          (eq bits '7bit))
       bits)
      ((and (not mm-use-ultra-safe-encoding)
+          (not longp)
           (or (eq t (cdr message-posting-charset))
               (memq charset (cdr message-posting-charset))
               (eq charset mail-parse-charset)))
index 200dea0..eb7c7f5 100644 (file)
@@ -299,7 +299,8 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
              (with-temp-buffer
                (setq charset (mm-charset-to-coding-system 
                               (cdr (assq 'charset cont))))
-               (if (eq charset 'ascii) (setq charset nil))
+               (when (eq charset 'ascii)
+                 (setq charset nil))
                (cond
                 ((cdr (assq 'buffer cont))
                  (insert-buffer-substring (cdr (assq 'buffer cont))))
@@ -316,7 +317,8 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
                    ;; Remove quotes from quoted tags.
                    (goto-char (point-min))
                    (while (re-search-forward
-                           "<#!+/?\\(part\\|multipart\\|external\\|mml\\)" nil t)
+                           "<#!+/?\\(part\\|multipart\\|external\\|mml\\)"
+                           nil t)
                      (delete-region (+ (match-beginning 0) 2)
                                     (+ (match-beginning 0) 3))))))
                (cond