summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-cite.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2010-10-31 22:31:24 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-10-31 22:31:24 +0000
commit389b76fa1b4e96b7da8896cea16d57403d76a947 (patch)
tree43e56629071d13a0817e6fdff598ce806d5ce4d5 /lisp/gnus/gnus-cite.el
parent430e7297cbfe8c2ef14b5b703fc56c4efce439c0 (diff)
downloademacs-389b76fa1b4e96b7da8896cea16d57403d76a947.tar.gz
Merge changes made in Gnus trunk.
nnimap.el (nnimap-open-connection): Only send AUTHENTICATE PLAIN if LOGINDISABLED is set. gnus.el (gnus-group-startup-message): Move point to the start of the buffer. nndoc.el (nndoc-dissect-buffer): Reverse the order of the articles to reflect the order they're in in the digest. gnus-sum.el (gnus-summary-select-article): Make `C-d' work reliably by checking whether the original article buffer is alive. shr.el (shr-find-fill-point): Don't break lines between punctuation and non-punctuation (like after the apostrophe in "'We"). gnus-cite.el (gnus-article-fill-cited-article): Remove unused `force' parameter. gnus-art.el (gnus-treatment-function-alist): Have gnus-treat-fill-long-lines point to gnus-article-fill-cited-long-lines. gnus-art.el (gnus-treat-fill-long-lines): Change default to fill all text/plain sections. gnus.el: Autoload gnus-article-fill-cited-long-lines. gnus-art.el (gnus-mime-display-alternative): Actually pass the type on to `gnus-treat-article'. gnus-sum.el (gnus-summary-show-article): Add `C-u C-u g' for showing the raw article, and change `C-u g' to show the article without doing treatments. gnus.texi (Paging the Article): Document C-u g/C-u C-u g. gnus-cite.el (gnus-article-foldable-buffer): Refactor out. gnus-cite.el (gnus-article-foldable-buffer): Don't fold regions that have a ragged left edge. gnus-cite.el (gnus-article-foldable-buffer): Skip past the prefix when determining raggedness. gnus-srvr.el, nnir.el: Allow nnir searching for an entire server. gnus-msg.el (gnus-configure-posting-styles): Permit the use of regular expression match and replace in posting styles. gnus-art.el (gnus-treat-article): Only inhibit body washing, and leave the header washing to take place. nnimap.el (nnimap-request-accept-article): Erase buffer before appending for easier debugging. nnimap.el (nnimap-wait-for-connection): Take a regexp. nnimap.el (nnimap-request-accept-article): Wait for the continuation line before sending anything unless we're streaming.
Diffstat (limited to 'lisp/gnus/gnus-cite.el')
-rw-r--r--lisp/gnus/gnus-cite.el39
1 files changed, 35 insertions, 4 deletions
diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el
index 7419cedac5f..a010a833e9d 100644
--- a/lisp/gnus/gnus-cite.el
+++ b/lisp/gnus/gnus-cite.el
@@ -516,10 +516,15 @@ Lines matching `gnus-cite-attribution-suffix' and perhaps
(setq m (cdr m))))
marks))))
-(defun gnus-article-fill-cited-article (&optional force 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."
- (interactive (list t current-prefix-arg))
+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)
(inhibit-point-motion-hooks t)
@@ -535,8 +540,12 @@ If WIDTH (the numerical prefix), use that text width when filling."
(fill-prefix
(if (string= (cdar marks) "") ""
(concat (cdar marks) " ")))
+ (do-fill (not long-lines))
use-hard-newlines)
- (fill-region (point-min) (point-max)))
+ (unless do-fill
+ (setq do-fill (gnus-article-foldable-buffer (cdar marks))))
+ (when do-fill
+ (fill-region (point-min) (point-max))))
(set-marker (caar marks) nil)
(setq marks (cdr marks)))
(when marks
@@ -548,6 +557,28 @@ If WIDTH (the numerical prefix), use that text width when filling."
gnus-cite-loose-attribution-alist nil
gnus-cite-article nil)))))
+(defun gnus-article-foldable-buffer (prefix)
+ (let ((do-fill nil)
+ columns)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (forward-char (length prefix))
+ (skip-chars-forward " \t")
+ (unless (eolp)
+ (let ((elem (assq (current-column) columns)))
+ (unless elem
+ (setq elem (cons (current-column) 0))
+ (push elem columns))
+ (setcdr elem (1+ (cdr elem)))))
+ (end-of-line)
+ (when (> (current-column) (frame-width))
+ (setq do-fill t))
+ (forward-line 1))
+ (and do-fill
+ ;; We know know that there are long lines here, but does this look
+ ;; like code? Check for ragged edges on the left.
+ (< (length columns) 3))))
+
(defun gnus-article-natural-long-line-p ()
"Return true if the current line is long, and it's natural text."
(save-excursion