2002-01-02 ShengHuo ZHU <zsh@cs.rochester.edu>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 3 Jan 2002 01:00:53 +0000 (01:00 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 3 Jan 2002 01:00:53 +0000 (01:00 +0000)
* gnus-picon.el (gnus-picon-transform-newsgroups): Fix for the case
  "Newsgroups: rec.music.beatles.moderated, rec.music.beatles".

lisp/ChangeLog
lisp/gnus-picon.el

index 21b607f..ca9ad64 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-02  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-picon.el (gnus-picon-transform-newsgroups): Fix for the case
+         "Newsgroups: rec.music.beatles.moderated, rec.music.beatles".
+
 2002-01-03  Steve Youngs  <youngs@xemacs.org>
 
        * gnus-sum.el (gnus-summary-make-menu-bar): XEmacs doesn't
index 4aff003..a878b32 100644 (file)
@@ -204,10 +204,9 @@ GLYPH can be either a glyph or a string."
 (defun gnus-picon-transform-newsgroups (header)
   (interactive)
   (gnus-with-article-headers
-    (let ((groups
-          (sort
-           (message-tokenize-header (mail-fetch-field header))
-           (lambda (g1 g2) (> (length g1) (length g2)))))
+    (gnus-article-goto-header header)
+    (mail-header-narrow-to-field)
+    (let ((groups (message-tokenize-header (mail-fetch-field header)))
          spec file point)
       (dolist (group groups)
        (setq spec (nreverse (split-string group "[.]")))
@@ -220,17 +219,16 @@ GLYPH can be either a glyph or a string."
            (setcar (nthcdr i spec)
                    (cons (gnus-picon-create-glyph file)
                          (nth i spec)))))
-       
-       (gnus-article-goto-header header)
-       (mail-header-narrow-to-field)
        (when (search-forward group nil t)
          (delete-region (match-beginning 0) (match-end 0))
-         (setq point (point))
-         (while spec
-           (goto-char point)
-           (if (> (length spec) 1)
-               (insert "."))
-           (gnus-picon-insert-glyph (pop spec) 'newsgroups-picon)))))))
+         (save-restriction
+           (narrow-to-region (point) (point))
+           (while spec
+             (goto-char (point-min))
+             (if (> (length spec) 1)
+                 (insert "."))
+             (gnus-picon-insert-glyph (pop spec) 'newsgroups-picon))
+           (goto-char (point-max))))))))
 
 ;;; Commands: