(mm-body-encoding): Use it.
(mm-body-encoding): Encode articles with lines longer than 1000
characters.
+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
(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)
(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)))
(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))))
;; 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