fix list-identifiers.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 13 May 2000 05:00:16 +0000 (05:00 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 13 May 2000 05:00:16 +0000 (05:00 +0000)
lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-sum.el
lisp/message.el

index 1806d72..059d8c6 100644 (file)
@@ -1,3 +1,11 @@
+2000-05-13 00:54:46  Shenghuo ZHU  <zsh@cs.rochester.edu>
+
+       * message.el (message-strip-list-identifiers): New function.
+       (message-reply): Use it and use message-strip-subject-re.
+       (message-followup): Ditto.
+       * gnus-art.el (article-hide-list-identifiers): Remove more.
+       * gnus-sum.el (gnus-summary-remove-list-identifiers): Ditto.
+
 2000-05-12 22:28:54  Shenghuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-uu.el (gnus-uu-digest-mail-forward): Bind
index 27a38b4..7124069 100644 (file)
@@ -1563,9 +1563,14 @@ The `gnus-list-identifiers' variable specifies what to do."
          (when regexp
            (goto-char (point-min))
            (when (re-search-forward
-                  (concat "^Subject: +\\(Re: +\\)?\\(" regexp " *\\)")
+                  (concat "^Subject: +\\(\\(\\(Re: +\\)?\\(" regexp 
+                          " *\\)\\)+\\(Re: +\\)?\\)")
                   nil t)
-             (delete-region (match-beginning 2) (match-end 0)))))))))
+             (let ((s (or (match-string 3) (match-string 5))))
+               (delete-region (match-beginning 1) (match-end 1))
+               (when s
+                 (goto-char (match-beginning 1))
+                 (insert s))))))))))
 
 (defun article-hide-pgp ()
   "Remove any PGP headers and signatures in the current article."
index 85843a5..8b06100 100644 (file)
@@ -4074,13 +4074,17 @@ or a straight list of headers."
                    gnus-list-identifiers
                  (mapconcat 'identity gnus-list-identifiers " *\\|"))))
     (dolist (header gnus-newsgroup-headers)
-      (when (string-match (concat "\\(Re: +\\)?\\(" regexp " *\\)")
+      (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp 
+                                 " *\\)\\)+\\(Re: +\\)?\\)")
                          (mail-header-subject header))
        (mail-header-set-subject
         header (concat (substring (mail-header-subject header)
-                                  0 (match-beginning 2))
+                                  0 (match-beginning 1))
+                       (or
+                        (match-string 3 (mail-header-subject header))
+                        (match-string 5 (mail-header-subject header)))
                        (substring (mail-header-subject header)
-                                  (match-end 2))))))))
+                                  (match-end 1))))))))
 
 (defun gnus-select-newsgroup (group &optional read-all select-articles)
   "Select newsgroup GROUP.
index ff9880f..ad4b06e 100644 (file)
@@ -1012,6 +1012,7 @@ should be sent in several parts. If it is nil, the size is unlimited."
   (autoload 'gnus-open-server "gnus-int")
   (autoload 'gnus-request-post "gnus-int")
   (autoload 'gnus-alive-p "gnus-util")
+  (autoload 'gnus-list-identifiers "gnus-sum")
   (autoload 'rmail-output "rmail"))
 
 \f
@@ -1135,6 +1136,20 @@ should be sent in several parts. If it is nil, the size is unlimited."
       (and (listp form) (eq (car form) 'lambda))
       (byte-code-function-p form)))
 
+(defun message-strip-list-identifiers (subject)
+  "Remove list identifiers in `gnus-list-identifiers'."
+  (let ((regexp (if (stringp gnus-list-identifiers)
+                   gnus-list-identifiers
+                 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
+    (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp 
+                               " *\\)\\)+\\(Re: +\\)?\\)") subject)
+       (concat (substring subject 0 (match-beginning 1))
+               (or (match-string 3 subject)
+                   (match-string 5 subject))
+               (substring subject
+                          (match-end 1)))
+      subject)))
+
 (defun message-strip-subject-re (subject)
   "Remove \"Re:\" from subject lines."
   (if (string-match message-subject-re-regexp subject)
@@ -3676,11 +3691,9 @@ OTHER-HEADERS is an alist of header/value pairs."
            date (message-fetch-field "date")
            from (message-fetch-field "from")
            subject (or (message-fetch-field "subject") "none"))
-    ;; Remove any (buggy) Re:'s that are present and make a
-    ;; proper one.
-    (when (string-match message-subject-re-regexp subject)
-      (setq subject (substring subject (match-end 0))))
-    (setq subject (concat "Re: " subject))
+    (if gnus-list-identifiers
+       (setq subject (message-strip-list-identifiers subject)))
+    (setq subject (concat "Re: " (message-strip-subject-re subject)))
 
     (when (and (setq gnus-warning (message-fetch-field "gnus-warning"))
               (string-match "<[^>]+>" gnus-warning))
@@ -3751,11 +3764,9 @@ If TO-NEWSGROUPS, use that as the new Newsgroups line."
                 (let ((case-fold-search t))
                   (string-match "world" distribution)))
        (setq distribution nil))
-      ;; Remove any (buggy) Re:'s that are present and make a
-      ;; proper one.
-      (when (string-match message-subject-re-regexp subject)
-       (setq subject (substring subject (match-end 0))))
-      (setq subject (concat "Re: " subject))
+      (if gnus-list-identifiers
+         (setq subject (message-strip-list-identifiers subject)))
+      (setq subject (concat "Re: " (message-strip-subject-re subject)))
       (widen))
 
     (message-pop-to-buffer (message-buffer-name "followup" from newsgroups))