* gnus-fun.el (gnus-convert-gray-x-face-to-xpm): Improved to speed
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 18 Feb 2002 04:33:21 +0000 (04:33 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 18 Feb 2002 04:33:21 +0000 (04:33 +0000)
up.  Suggested by Yuuichi Teranishi <teranisi@gohome.org>.

* gnus-art.el (article-display-x-face): Sort gray X-Faces.

lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-fun.el

index 5320f36..dffe612 100644 (file)
@@ -1,8 +1,15 @@
+2002-02-18  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-fun.el (gnus-convert-gray-x-face-to-xpm): Improved to speed
+       up.  Suggested by Yuuichi Teranishi <teranisi@gohome.org>.
+
+       * gnus-art.el (article-display-x-face): Sort gray X-Faces.
+
 2002-02-17  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        Some ideas is inspired by code from Hrvoje Niksic
        <hniksic@arsdigita.com>
-       
+
        * gnus-art.el (gnus-article-wash-function): Set the default to
        nil, so that we use mm-text-html-renderer instead.
        (article-wash-html): Use mm-text-html-renderer.
@@ -11,7 +18,7 @@
        (mm-text-html-renderer): New variable.
        (mm-inline-text-html-renderer): Set the default to nil, so that we
        use mm-text-html-renderer instead.
-       
+
        * mm-view.el (mm-inline-text-html): New function.
        (mm-text-html-renderer-alist): New variable.
        (mm-inline-text-vcard): New function.
@@ -25,7 +32,7 @@
        (mm-inline-wash-with-stdin): New function.
 
 2002-02-17  ShengHuo ZHU  <zsh@cs.rochester.edu>
-       
+
        * message-utils.el: Fix installation doc.
        From: Reiner Steib <4uce.02.r.steib@gmx.net>
 
index aaeb4c3..c2f967e 100644 (file)
@@ -1843,13 +1843,22 @@ unfolded."
              (set-buffer gnus-original-article-buffer))
            (save-restriction
              (mail-narrow-to-head)
-             (let ((regexp
-                    (if gnus-treat-display-grey-xface
-                        "x-face\\(-[0-9]+\\)?"
-                      "x-face")))
-               (while (gnus-article-goto-header regexp)
-                 (when (match-beginning 2)
-                   (setq grey t))
+             (if gnus-treat-display-grey-xface
+                 (progn
+                   (while (gnus-article-goto-header "X-Face\\(-[0-9]+\\)?")
+                     (if (match-beginning 2)
+                         (progn
+                           (setq grey t)
+                           (push (cons (string-to-number (match-string 2))
+                                       (mail-header-field-value))
+                                 x-faces))
+                       (push (cons 0 (mail-header-field-value)) x-faces)))
+                   (dolist (x-face (prog1
+                                       (nreverse (sort x-faces
+                                                       'car-less-than-car))
+                                     (setq x-faces nil)))
+                     (push (cdr x-face) x-faces)))
+               (while (gnus-article-goto-header "X-Face")
                  (push (mail-header-field-value) x-faces)))
              (setq from (message-fetch-field "from"))))
          (if grey
index 4cbf10f..c1d6cd8 100644 (file)
@@ -119,35 +119,37 @@ Output to the current buffer, replace text, and don't mingle error."
   (let* ((depth (length faces))
         (scale (/ 255 (1- (expt 2 depth))))
         (ok-p t)
-        bit-list bit-lists pixels pixel)
-    (dolist (face faces)
-      (setq bit-list nil)
-      (with-temp-buffer
+        (coding-system-for-read 'binary)
+        (coding-system-for-write 'binary)
+        default-enable-multibyte-characters
+        start bit-array bit-arrays pixels pixel)
+    (with-temp-buffer
+      (dolist (face faces)
+       (erase-buffer)
        (insert (uncompface face))
        (gnus-shell-command-on-region
         (point-min) (point-max)
         "pnmnoraw")
        (goto-char (point-min))
        (forward-line 2)
+       (setq start (point))
+       (insert "[")
        (while (not (eobp))
-         (cond
-          ((eq (following-char) ?0)
-           (push 0 bit-list))
-          ((eq (following-char) ?1)
-           (push 1 bit-list)))
-         (forward-char 1)))
-      (unless (= (length bit-list) (* 48 48))
-       (setq ok-p nil))
-      (push bit-list bit-lists))
-    (when ok-p
-      (dotimes (i (* 48 48))
-       (setq pixel 0)
-       (dotimes (plane depth)
-         (setq pixel (+ (* pixel 2) (nth i (nth plane bit-lists)))))
-       (push pixel pixels))
-      (with-temp-buffer
+         (forward-char 1)
+         (insert " "))
+       (insert "]")
+       (goto-char start)
+       (setq bit-array (read (current-buffer)))
+       (unless (= (length bit-array) (* 48 48))
+         (setq ok-p nil))
+       (push bit-array bit-arrays))
+      (when ok-p
+       (erase-buffer)
        (insert "P2\n48 48\n255\n")
-       (dolist (pixel pixels)
+       (dotimes (i (* 48 48))
+         (setq pixel 0)
+         (dotimes (plane depth)
+           (setq pixel (+ (* pixel 2) (aref (nth plane bit-arrays) i))))
          (insert (number-to-string (* scale pixel)) " "))
        (gnus-shell-command-on-region
         (point-min) (point-max)