+(defun gnus-dissect-cited-text ()
+ "Dissect the article buffer looking for cited text."
+ (save-excursion
+ (set-buffer gnus-article-buffer)
+ (gnus-cite-parse-maybe)
+ (let ((alist gnus-cite-prefix-alist)
+ prefix numbers number marks m)
+ ;; Loop through citation prefixes.
+ (while alist
+ (setq numbers (pop alist)
+ prefix (pop numbers))
+ (while numbers
+ (setq number (pop numbers))
+ (goto-char (point-min))
+ (forward-line number)
+ (push (cons (point-marker) "") marks)
+ (while (and numbers
+ (= (1- number) (car numbers)))
+ (setq number (pop numbers)))
+ (goto-char (point-min))
+ (forward-line (1- number))
+ (push (cons (point-marker) prefix) marks)))
+ ;; Skip to the beginning of the body.
+ (goto-char (point-min))
+ (search-forward "\n\n" nil t)
+ (push (cons (point-marker) "") marks)
+ ;; Find the end of the body.
+ (goto-char (point-max))
+ (gnus-article-search-signature)
+ (push (cons (point-marker) "") marks)
+ ;; Sort the marks.
+ (setq marks (sort marks 'car-less-than-car))
+ (let ((omarks marks))
+ (setq marks nil)
+ (while (cdr omarks)
+ (if (= (caar omarks) (caadr omarks))
+ (progn
+ (unless (equal (cdar omarks) "")
+ (push (car omarks) marks))
+ (unless (equal (cdadr omarks) "")
+ (push (cadr omarks) marks))
+ (unless (and (equal (cdar omarks) "")
+ (equal (cdadr omarks) "")
+ (not (cddr omarks)))
+ (setq omarks (cdr omarks))))
+ (push (car omarks) marks))
+ (setq omarks (cdr omarks)))
+ (when (car omarks)
+ (push (car omarks) marks))
+ (setq marks (setq m (nreverse marks)))
+ (while (cddr m)
+ (if (and (equal (cdadr m) "")
+ (equal (cdar m) (cdaddr m))
+ (goto-char (caadr m))
+ (forward-line 1)
+ (= (point) (caaddr m)))
+ (setcdr m (cdddr m))
+ (setq m (cdr m))))
+ marks))))
+
+(defun gnus-article-fill-cited-article (&optional force width)
+ "Do word wrapping in the current article.
+If WIDTH (the numerical prefix), use that text width when filling."
+ (interactive (list t current-prefix-arg))
+ (save-excursion
+ (set-buffer gnus-article-buffer)
+ (let ((buffer-read-only nil)
+ (inhibit-point-motion-hooks t)
+ (marks (gnus-dissect-cited-text))
+ (adaptive-fill-mode nil)
+ (filladapt-mode nil)
+ (fill-column (if width (prefix-numeric-value width) fill-column)))
+ (save-restriction
+ (while (cdr marks)
+ (widen)
+ (narrow-to-region (caar marks) (caadr marks))
+ (let ((adaptive-fill-regexp
+ (concat "^" (regexp-quote (cdar marks)) " *"))
+ (fill-prefix (cdar marks)))
+ (fill-region (point-min) (point-max)))
+ (set-marker (caar marks) nil)
+ (setq marks (cdr marks)))
+ (when marks
+ (set-marker (caar marks) nil))
+ ;; All this information is now incorrect.
+ (setq gnus-cite-prefix-alist nil
+ gnus-cite-attribution-alist nil
+ gnus-cite-loose-prefix-alist nil
+ gnus-cite-loose-attribution-alist nil
+ gnus-cite-article nil)))))
+
+(defun gnus-article-hide-citation (&optional arg force)
+ "Toggle hiding of all cited text except attribution lines.
+See the documentation for `gnus-article-highlight-citation'.
+If given a negative prefix, always show; if given a positive prefix,
+always hide."
+ (interactive (append (gnus-article-hidden-arg) (list 'force)))
+ (gnus-set-format 'cited-opened-text-button t)
+ (gnus-set-format 'cited-closed-text-button t)
+ (save-excursion
+ (set-buffer gnus-article-buffer)
+ (cond
+ ((gnus-article-check-hidden-text 'cite arg)
+ t)
+ ((gnus-article-text-type-exists-p 'cite)
+ (let ((buffer-read-only nil))
+ (gnus-article-hide-text-of-type 'cite)))
+ (t