2003-01-02 Matthieu Moy <Matthieu.Moy@imag.fr>
[gnus] / lisp / gnus-cite.el
index 73c4bef..59ccf01 100644 (file)
@@ -1,6 +1,6 @@
-;;; gnus-cite.el --- parse citations in articles for Gnus  -*- coding: iso-latin-1 -*-
+;;; gnus-cite.el --- parse citations in articles for Gnus
 
-;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
+;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Per Abhiddenware
@@ -259,6 +259,11 @@ This should make it easier to see who wrote what."
   :group 'gnus-cite
   :type 'integer)
 
+(defcustom gnus-cite-blank-line-after-header t
+  "If non-nil, put a blank line between the citation header and the button."
+  :group 'gnus-cite
+  :type 'boolean)
+
 ;;; Internal Variables:
 
 (defvar gnus-cite-article nil)
@@ -441,7 +446,8 @@ If WIDTH (the numerical prefix), use that text width when filling."
                 (concat "^" (regexp-quote (cdar marks)) " *"))
                (fill-prefix
                 (if (string= (cdar marks) "") ""
-                  (concat (cdar marks) " "))))
+                  (concat (cdar marks) " ")))
+               use-hard-newlines)
            (fill-region (point-min) (point-max)))
          (set-marker (caar marks) nil)
          (setq marks (cdr marks)))
@@ -471,8 +477,8 @@ always hide."
                          gnus-hidden-properties))
            (point (point-min))
            found beg end start)
-       (while (setq point 
-                    (text-property-any point (point-max) 
+       (while (setq point
+                    (text-property-any point (point-max)
                                        'gnus-callback
                                        'gnus-article-toggle-cited-text))
          (setq found t)
@@ -510,13 +516,15 @@ always hide."
                      (setq beg nil)
                  (setq end (point-marker))))))
            (when (and beg end)
+             (gnus-add-wash-type 'cite)
              ;; 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-when 'article-type nil beg end props)
              (goto-char beg)
-             (unless (save-excursion (search-backward "\n\n" nil t))
+             (when (and gnus-cite-blank-line-after-header
+                        (not (save-excursion (search-backward "\n\n" nil t))))
                (insert "\n"))
              (put-text-property
               (setq start (point-marker))
@@ -548,14 +556,20 @@ means show, nil means toggle."
              (and (> arg 0) (not hidden))
              (and (< arg 0) hidden))
       (if hidden
-         (gnus-remove-text-properties-when
-          'article-type 'cite beg end 
-          (cons 'article-type (cons 'cite
-                                    gnus-hidden-properties)))
+         (progn
+           ;; Can't remove 'cite from g-a-wash-types here because
+           ;; multiple citations may be hidden -jas
+           (gnus-remove-text-properties-when
+            'article-type 'cite beg end
+            (cons 'article-type (cons 'cite
+                                      gnus-hidden-properties))))
+       (gnus-add-wash-type 'cite)
        (gnus-add-text-properties-when
-        'article-type nil beg end 
+        'article-type nil beg end
         (cons 'article-type (cons 'cite
                                   gnus-hidden-properties))))
+      (let ((gnus-article-mime-handle-alist-1 gnus-article-mime-handle-alist))
+       (gnus-set-mode-line 'article))
       (save-excursion
        (goto-char start)
        (gnus-delete-line)
@@ -953,14 +967,20 @@ See also the documentation for `gnus-article-highlight-citation'."
        (goto-char (point-min))
        (forward-line (1- number))
        (cond ((get-text-property (point) 'invisible)
+              ;; Can't remove 'cite from g-a-wash-types here because
+              ;; multiple citations may be hidden -jas
               (remove-text-properties (point) (progn (forward-line 1) (point))
                                       gnus-hidden-properties))
              ((assq number gnus-cite-attribution-alist))
              (t
+              (gnus-add-wash-type 'cite)
               (gnus-add-text-properties
                (point) (progn (forward-line 1) (point))
                (nconc (list 'article-type 'cite)
-                      gnus-hidden-properties))))))))
+                      gnus-hidden-properties))))
+       (let ((gnus-article-mime-handle-alist-1
+              gnus-article-mime-handle-alist))
+         (gnus-set-mode-line 'article))))))
 
 (defun gnus-cite-find-prefix (line)
   ;; Return citation prefix for LINE.