[mew-dist 23627] mew-nmz.el for Mew 4

橋 宏彰 hasi at example.com
2003年 5月 11日 (日) 23:03:57 JST


Mew 4 のための mew-nmz.el パッチです。

# とりあえず動きます。

変なところがなければマージしてもらえるとうれしいです。

--
  橋 宏彰 <hasi at example.com>
-------------- next part --------------
--- mew-nmz.el.orig	Tue Mar 25 11:28:48 2003
+++ mew-nmz.el	Sun May 11 22:53:28 2003
@@ -408,7 +408,7 @@
 	     (goto-char (point-min))
 	     (while (not (eobp))
 	       (if (and
-		    (looking-at "^ *\\([1-9][0-9]*\\)")
+		    (looking-at "^[^\r]*\r [^ ]+ \\([0-9]+\\)")
 		    (not (memq (string-to-number (match-string 1)) msgnums))
 		    (not (mew-in-decode-syntax-p)))
 		   (progn
@@ -624,7 +624,7 @@
 	       (setq i 0)
 	       (setq msgs msgsback)
 	       (while (and msgs (not (eobp)))
-		 (when (re-search-forward (mew-regex-jmp-msg (car msgs)) nil t)
+		 (when (mew-nmz-re-search-message (car msgs))
 		   (mew-summary-mark-as mew-mark-review)
 		   (forward-line))
 		 (setq i (1+ i))
@@ -675,7 +675,7 @@
 	  (when fasts
 	    (while (setq fld (car (car fasts)))
 	      (message "Namazu picking...(%s)" fld)
-	      (setq pattern "")
+	      (setq lines nil)
 	      (setq msgs (cdr (car fasts)))
 	      (set-buffer buf)
 	      (buffer-disable-undo (current-buffer))
@@ -686,25 +686,38 @@
 		(expand-file-name mew-summary-cache-file (mew-expand-folder fld))))
 	      (goto-char (point-min))
 	      (while (and (not (eobp)) msgs)
-		(when (re-search-forward (concat "^ *" (car msgs) "[^0-9]") nil t)
+		(when (mew-nmz-re-search-message (car msgs))
 		  (beginning-of-line)
-		  (when (looking-at	;; new format "\r <msgid> <par-id> \006 folder msg"
-			 "^ *\\([1-9][0-9]*\\)[^0-9]\\([^\r]*\r\\)\\([^\n]*\\)")
-		    (setq pattern
-			  ;; 123 .... \r  <msgid> <par-id> folder num
-			  (concat pattern
-				  (format "%5d %s%s \006 %s %s\n"
-					  count
-					  (match-string 2)	;; don't use match-string
-					  (match-string 3)	;; for fancy-hightlight
-					  fld (car msgs))))
+		  (when (looking-at
+			 "^\\([^\r]*\\)\\(\r[^\n]*\n\\)")
+		    (setq lines (cons (list
+				       (match-string 1)
+				       (match-string 2))
+				      lines))
 		    (setq count (1+ count))))
-		(setq msgs (cdr msgs))
-		(forward-line 1))
-	      (mew-summary-switch-to-folder vfld)
-	      (goto-char (point-max))
-	      (mew-elet
-	       (insert pattern))
+		(forward-line 1)
+		(setq msgs (cdr msgs)))
+	      (setq lines (nreverse lines))
+	      (when lines
+		(mew-summary-switch-to-folder vfld)
+		(goto-char (point-max))
+		(while (setq line (car lines))
+		  (mew-elet 
+		   (setq beg (point))
+		   (insert (car line))
+		   (setq med (point))
+		   (insert (car (cdr line)))
+		   (setq end (point))
+		   (goto-char beg)
+		   (mew-front-nonsticky beg med) ;; for XEmacs
+		   (if mew-use-highlight-mouse-line
+		       (put-text-property
+			beg med 'mouse-face mew-highlight-mouse-line-face))
+		   (forward-line)
+		   (put-text-property med (1- (point)) 'invisible t))
+		  (goto-char (point-max))
+		  (setq lines (cdr lines)))
+		(mew-summary-set-count-line))
 	      (setq fasts (cdr fasts))))
 	  (if (null scans)
 	      (message "Namazu picking...done")
@@ -728,7 +741,7 @@
 	  (when scans
 	    (setq func `(lambda () (when (file-exists-p ,file)
 				     (delete-file ,file))))
-	    (mew-local-retrieve 'vir (list "-i" file) count func lra 'noerase)))))))
+	    (mew-local-retrieve 'vir (list "-i" file) func lra)))))))
 
 ;;
 ;; Use namazu-mode.
@@ -1003,8 +1016,9 @@
   (while (processp mew-summary-buffer-process)
     (sit-for 1)
     (discard-input))
-  (mew-summary-jump-message msg)
-  (mew-summary-thread-move-cursor)
+  (goto-char (point-min))
+  (mew-nmz-re-search-message msg)
+  ;;(mew-summary-thread-move-cursor)
   (mew-summary-display 'force))
 
 (defun mew-nmz-make-temp-name (prefix)
@@ -1049,12 +1063,8 @@
     (message "Ignore url(%s) in %s." url "NMZ.field.uri")))
 
 (defun mew-nmz-index-newp (fld)
-  (let ((touchtime (if mew-touch-folder-p
-		       (mew-file-get-time
-			(expand-file-name mew-summary-touch-file
-					  (mew-expand-folder fld)))
-		     (mew-file-get-time
-		      (file-chase-links (mew-expand-folder fld)))))
+  (let ((touchtime (mew-file-get-time
+		    (file-chase-links (mew-expand-folder fld))))
 	(stamptime (if mew-nmz-mknmz-use-timestamp
 		       (mew-file-get-time
 			(expand-file-name
@@ -1073,16 +1083,12 @@
   (let ((buf (get-buffer fld)))
     (if (not buf)
 	(let ((dir (file-chase-links (mew-expand-folder fld)))
-	      (tdir (if mew-touch-folder-p
-			(mew-file-get-time
-			 (expand-file-name mew-summary-touch-file
-					   (mew-expand-folder fld)))
-		      (mew-file-get-time
-		       (file-chase-links (mew-expand-folder fld)))))
+	      (tdir (mew-file-get-time
+		     (file-chase-links (mew-expand-folder fld))))
 	      (tfile (mew-file-get-time
 		      (expand-file-name mew-summary-cache-file
 					(mew-expand-folder fld)))))
-	  (if (and mew-touch-folder-p (null tdir)
+	  (if (and (null tdir)
 		   (file-directory-p dir)
 		   (mew-dir-messages (mew-expand-folder dir)))
 	      nil
@@ -1174,6 +1180,19 @@
 	    (rename-file nfile tfile 'ok)
 	  (if (file-writable-p nfile)
 	      (delete-file nfile))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; Moving to message
+;;;
+
+(defun mew-nmz-re-search-message (msg)
+  (let (here (point))
+    (if (not (re-search-forward (concat "^.*\r [^ ]+ " msg "[^0-9]") nil t))
+	(progn (goto-char here)
+	       nil)
+      (beginning-of-line)
+      t)))
 
 (provide 'mew-nmz)
 


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