[Mew-dist 13767] scan w/o mewls.

Masaki KONUMA konuma at example.com
2000年 8月 4日 (金) 12:55:51 JST


mewls なしでの scan を試作しました。# C が嫌いな人向け :)
(Mew なので) cat で非同期にしてます。

-- 小沼雅樹
-------------- next part --------------
--- mew-1.95b51/mew-scan.el.orig	Wed Aug  2 23:01:48 2000
+++ mew-1.95b51/mew-scan.el	Fri Aug  4 12:37:40 2000
@@ -206,8 +206,7 @@
     ())
    (t
     (condition-case nil
-	(let ((process-connection-type mew-connection-type1)
-	      buf bnm)
+	(let ((process-connection-type mew-connection-type1))
 	  (buffer-disable-undo (current-buffer))
 	  (if (not (eq major-mode mode)) (funcall mode))
 	  (mew-window-configure (current-buffer) 'summary)
@@ -222,27 +221,30 @@
 	      (mew-erase-buffer))
 	  (setq mew-summary-buffer-start-point (point))
 	  (setq mew-summary-buffer-config mew-config-input)
-	  (setq bnm (buffer-name))
-	  (setq buf (get-buffer-create (concat " *mew " bnm)))
-	  (save-excursion
-	    (set-buffer buf)
-	    (mew-erase-buffer)
-	    (setq mew-scan-ids nil))
+	  (setq mew-scan-msgs
+		(cons (if (and (stringp range)
+			       (string-match "^\\([0-9]+\\)-" range))
+			  (match-string 1 range)
+			"0")
+		      (directory-files
+		       (mew-expand-folder folder)
+		       nil mew-regex-message-files 'no-sort)))
+	  (sort mew-scan-msgs
+		(function
+		 (lambda (a b) (< (string-to-number a) (string-to-number b)))))
+	  (setq mew-scan-msgs (cdr mew-scan-msgs))
+	  (setq mew-scan-ids nil)
 	  (mew-pioalet
 	   read mew-cs-pick mew-cs-pick ;; xxx need to re-consider
 	   (setq mew-summary-buffer-process
-		 (start-process (format "mew-process-<%s>" bnm)
-				buf mew-prog-mewls bnm range)))
-	  (mew-set-process-cs mew-summary-buffer-process
-			      ;; text may be broken, so undecided is
-			      ;; very dangerous!
-			      mew-cs-text-for-read
-			      mew-cs-dummy)
+		 (start-process "cat" (current-buffer) "cat")))
+	  (mew-set-process-cs mew-summary-buffer-process read mew-cs-dummy)
 	  (set-process-filter mew-summary-buffer-process
 			      'mew-summary-scan-filter)
 	  (set-process-sentinel mew-summary-buffer-process
 				'mew-summary-scan-sentinel)
 	  (setq mew-summary-buffer-reviews reviews)
+	  (process-send-string nil " \n")
 	  (process-kill-without-query mew-summary-buffer-process))
       (quit
        (set-process-sentinel mew-summary-buffer-process nil)
@@ -251,33 +253,35 @@
        (setq mew-summary-buffer-reviews nil))))))
 
 (defun mew-summary-scan-filter (process string)
-  (let ((after-change-functions nil)
-	(width (mew-scan-width))
-	(pnm (process-name process))
-	vec line opos omax)
-    (mew-filter
-     (goto-char (point-max))
-     (mew-elet (insert string))
-     (goto-char (point-min))
-     (mew-set-buffer-multibyte nil)
-     (while (and (re-search-forward mew-eoh nil t) (not (eobp)))
-       (mew-set-buffer-multibyte t)
-       (setq vec (mew-scan-header))
-       (setq line (mew-scan-format vec width))
-       (mew-set-buffer-multibyte nil)
-       (save-excursion
-	 (if (string-match "<\\([^>]+\\)>" pnm)
-	     (set-buffer (mew-match 1 pnm)))
-	 (setq opos (point))
-	 (setq omax (point-max))
-	 (goto-char (point-max))
-	 (mew-elet (insert (nth 0 line) (nth 1 line) "\n"))
-	 (if (or (eq opos mew-summary-buffer-start-point)
-		 (/= opos omax))
-	     ;; move the cursor to the original position.
-	     (goto-char opos)))
-       (forward-line)
-       (delete-region (point-min) (point))))))
+  (mew-filter
+   (if (atom mew-scan-msgs)
+       (process-send-eof)
+     (process-send-string nil " \n")
+     (let ((after-change-functions nil)
+	   (width (mew-scan-width))
+	   (opos (point)) (omax (point-max))
+	   (cnt 4) vec line msg)
+       (while (and (> cnt 0) mew-scan-msgs)
+	 (setq msg (car mew-scan-msgs))
+	 (setq mew-scan-msgs (cdr mew-scan-msgs))
+	 (setq cnt (1- cnt))
+	 (if (file-directory-p msg)
+	     ()
+	   (save-excursion
+	     (mew-set-buffer-tmp default-directory)
+	     (mew-frwlet
+	      mew-cs-autoconv mew-cs-dummy
+	      (insert-file-contents msg nil 0 mew-header-reasonable-size))
+	     (mew-header-goto-body)
+	     (setq vec (mew-scan-header))
+	     (aset vec 0 msg))
+	   (setq line (mew-scan-format vec width))
+	   (goto-char (point-max))
+	   (mew-elet (insert (nth 0 line) (nth 1 line) "\n"))))
+       (if (or (eq opos mew-summary-buffer-start-point)
+	       (/= opos omax))
+	   ;; move the cursor to the original position.
+	   (goto-char opos))))))
 
 (defun mew-summary-scan-sentinel (process event)
   (let ((pnm (process-name process))
-------------- next part --------------
--- mew-1.95b51/mew-blvs.el.orig	Mon Jul 31 20:20:53 2000
+++ mew-1.95b51/mew-blvs.el	Fri Aug  4 12:20:38 2000
@@ -74,6 +74,7 @@
 (defvar mew-cache-info nil)
 (defvar mew-decode-info nil)
 (defvar mew-icon-info nil)
+(defvar mew-scan-msgs nil)
 (defvar mew-scan-ids nil)
 
 (mapcar (function make-variable-buffer-local)
@@ -123,6 +124,7 @@
 	      'mew-cache-info
 	      'mew-decode-info
 	      'mew-icon-info
+	      'mew-scan-msgs
 	      'mew-scan-ids))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Mew-dist メーリングリストの案内