+ (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
+ (let ((buffer-read-only nil)
+ (marks (gnus-dissect-cited-text))
+ (inhibit-point-motion-hooks t)
+ (props (nconc (list 'article-type 'cite)
+ gnus-hidden-properties))
+ beg end start)
+ (while marks
+ (setq beg nil
+ end nil)
+ (while (and marks (string= (cdar marks) ""))
+ (setq marks (cdr marks)))
+ (when marks
+ (setq beg (caar marks)))
+ (while (and marks (not (string= (cdar marks) "")))
+ (setq marks (cdr marks)))
+ (when marks
+ (setq end (caar marks)))
+ ;; Skip past lines we want to leave visible.
+ (when (and beg end gnus-cited-lines-visible)
+ (goto-char beg)
+ (forward-line (if (consp gnus-cited-lines-visible)
+ (car gnus-cited-lines-visible)
+ gnus-cited-lines-visible))
+ (if (>= (point) end)
+ (setq beg nil)
+ (setq beg (point-marker))
+ (when (consp gnus-cited-lines-visible)
+ (goto-char end)
+ (forward-line (- (cdr gnus-cited-lines-visible)))
+ (if (<= (point) beg)
+ (setq beg nil)
+ (setq end (point-marker))))))
+ (when (and beg end)
+ ;; We use markers for the end-points to facilitate later
+ ;; wrapping and mangling of text.
+ (setq beg (set-marker (make-marker) beg)
+ end (set-marker (make-marker) end))
+ (gnus-add-text-properties beg end props)
+ (goto-char beg)
+ (unless (save-excursion (search-backward "\n\n" nil t))
+ (insert "\n"))
+ (put-text-property
+ (setq start (point-marker))
+ (progn
+ (gnus-article-add-button
+ (point)
+ (progn (eval gnus-cited-closed-text-button-line-format-spec)
+ (point))
+ `gnus-article-toggle-cited-text
+ (list (cons beg end) start))
+ (point))
+ 'article-type 'annotation)
+ (set-marker beg (point)))))))))
+
+(defun gnus-article-toggle-cited-text (args)
+ "Toggle hiding the text in REGION."
+ (let* ((region (car args))
+ (start (cadr args))
+ (hidden
+ (text-property-any
+ (car region) (1- (cdr region))
+ (car gnus-hidden-properties) (cadr gnus-hidden-properties)))
+ (inhibit-point-motion-hooks t)
+ buffer-read-only)
+ (funcall
+ (if hidden
+ 'remove-text-properties 'gnus-add-text-properties)
+ (car region) (cdr region) gnus-hidden-properties)
+ (save-excursion
+ (goto-char start)
+ (gnus-delete-line)
+ (put-text-property
+ (point)
+ (progn
+ (gnus-article-add-button
+ (point)
+ (progn (eval
+ (if hidden
+ gnus-cited-opened-text-button-line-format-spec
+ gnus-cited-closed-text-button-line-format-spec))
+ (point))
+ `gnus-article-toggle-cited-text
+ args)
+ (point))
+ 'article-type 'annotation))))
+
+(defun gnus-article-hide-citation-maybe (&optional arg force)
+ "Toggle hiding of cited text that has an attribution line.
+If given a negative prefix, always show; if given a positive prefix,
+always hide.