2010-10-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
+ * gnus-art.el (gnus-treatment-function-alist): Have
+ gnus-treat-fill-long-lines point to gnus-article-fill-cited-long-lines.
+ (gnus-treat-fill-long-lines): Change default to fill all text/plain
+ sections.
+
* gnus-cite.el (gnus-article-fill-cited-article): Remove unused `force'
parameter.
+ (gnus-article-fill-cited-long-lines): New function.
+ (gnus-article-fill-cited-article): Allow filling only long sections.
* shr.el (shr-find-fill-point): Don't break lines between punctuation
and non-punctuation (like after the apostrophe in "'We").
:link '(custom-manual "(gnus)Customizing Articles")
:type gnus-article-treat-custom)
-(defcustom gnus-treat-fill-long-lines nil
+(defcustom gnus-treat-fill-long-lines '(typep "text/plain")
"Fill long lines.
Valid values are nil, t, `head', `first', `last', an integer or a
predicate. See Info node `(gnus)Customizing Articles'."
(gnus-treat-highlight-signature gnus-article-highlight-signature)
(gnus-treat-buttonize gnus-article-add-buttons)
(gnus-treat-fill-article gnus-article-fill-cited-article)
- (gnus-treat-fill-long-lines gnus-article-fill-long-lines)
+ (gnus-treat-fill-long-lines gnus-article-fill-cited-long-lines)
(gnus-treat-strip-cr gnus-article-remove-cr)
(gnus-treat-unsplit-urls gnus-article-unsplit-urls)
(gnus-treat-date-ut gnus-article-date-ut)
(save-restriction
(article-goto-body)
(narrow-to-region (point) (point-max))
- (gnus-treat-article nil 1 1)
+ (gnus-treat-article nil 1 1 "text/plain")
(widen)))
(unless ihandles
;; Highlight the headers.
(setq m (cdr m))))
marks))))
-(defun gnus-article-fill-cited-article (&optional width)
+(defun gnus-article-fill-cited-long-lines ()
+ (gnus-article-fill-cited-article nil t))
+
+(defun gnus-article-fill-cited-article (&optional width long-lines)
"Do word wrapping in the current article.
-If WIDTH (the numerical prefix), use that text width when filling."
+If WIDTH (the numerical prefix), use that text width when
+filling. If LONG-LINES, only fill sections that have lines
+longer than the frame width."
(interactive "P")
(with-current-buffer gnus-article-buffer
(let ((buffer-read-only nil)
(fill-prefix
(if (string= (cdar marks) "") ""
(concat (cdar marks) " ")))
+ (do-fill (not long-lines))
use-hard-newlines)
- (fill-region (point-min) (point-max)))
+ (goto-char (point-min))
+ (unless do-fill
+ (while (not (eobp))
+ (end-of-line)
+ (when (> (current-column) (frame-width))
+ (setq do-fill t))
+ (forward-line 1)))
+ (when do-fill
+ (fill-region (point-min) (point-max))))
(set-marker (caar marks) nil)
(setq marks (cdr marks)))
(when marks