w3m-el (1.4.4-11) 020_mew-shimbun.patch

Summary

 shimbun/mew-shimbun.el |   47 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 17 deletions(-)

    
download this patch

Patch contents

Description: Update mew-shimbun.el for Mew 5
Bug-Debian: http://bugs.debian.org/377456
Origin: upstream, http://cvs.namazu.org/Development/emacs-w3m/shimbun/mew-shimbun.el?revision=1.55&view=markup

--- w3m-el-1.4.4.orig/shimbun/mew-shimbun.el	2005-03-16 06:49:41.000000000 +0900
+++ w3m-el-1.4.4/shimbun/mew-shimbun.el	2007-09-19 23:30:04.000000000 +0900
@@ -1,7 +1,7 @@
 ;; -*- mode: emacs-lisp -*-
 ;; mew-shimbun.el --- View shimbun contents with Mew
 
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
 ;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>
 
 ;; Author: TSUCHIYA Masatoshi <tsuchiya@namazu.org>
@@ -23,7 +23,7 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program; if not, you can either send email to this
 ;; program's maintainer or write to: The Free Software Foundation,
-;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
+;; Inc.; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 ;; This package is `Shimbun' interface for Mew version 2.1 or later.
@@ -296,6 +296,18 @@
     (unless (mew-sinfo-get-summary-form)
       (mew-sinfo-set-summary-form (mew-get-summary-form fld)))))
 
+(static-if (fboundp 'mew-expand-file)
+    ;; Mew 5
+    (defalias 'mew-shimbun-folder-file 'mew-expand-file)
+  (defun mew-shimbun-folder-file (fld file)
+    (expand-file-name file (mew-expand-folder fld))))
+
+(static-if (fboundp 'mew-expand-msg)
+    ;; Mew 5
+    (defalias 'mew-shimbun-expand-msg 'mew-expand-msg)
+  (defun mew-shimbun-expand-msg (fld msg)
+    (expand-file-name msg (mew-expand-folder fld))))
+
 (if (featurep 'xemacs)
     nil
   (eval-and-compile
@@ -356,7 +368,7 @@
 		    (when (re-search-forward (or mew-shimbun-unseen-regex
 						 (mew-shimbun-unseen-regex)) nil t)
 		      (setq sbflds (cons fld sbflds))))
-		(setq cfile (mew-expand-folder fld mew-summary-cache-file))
+		(setq cfile (mew-shimbun-folder-file fld mew-summary-cache-file))
 		(when (file-readable-p cfile)
 		  (with-temp-buffer
 		    (mew-frwlet
@@ -390,7 +402,7 @@
 	  (mew-summary-ls newfld newfld))))))
 
 ;;;###autoload
-(defun mew-shimbun-retrieve ()
+(defun mew-shimbun-retrieve (&optional newfld)
   "Retrieve articles via SHIMBUN on this folder."
   (interactive)
   (when (mew-summary-exclusive-p)
@@ -414,7 +426,7 @@
 	       (mew-shimbun-element-body sgr group server
 		 (setq count
 		       (+ (mew-shimbun-retrieve-article
-			   mua server group range fld)
+			   mua server group range fld newfld)
 			  count)))))
 	   (run-hooks 'mew-shimbun-retrieve-hook)
 	   (message "Getting %s %s in '%s' done"
@@ -431,7 +443,7 @@
   (mew-summary-only
    (let ((mua (luna-make-entity 'shimbun-mew-mua))
 	 (cfld (mew-summary-folder-name 'ext))
-	 fld dir server group range)
+	 fld dir server group range newfld)
      (run-hooks 'mew-shimbun-before-retrieve-hook)
      (mew-window-configure 'summary)
      (mew-current-set nil nil nil)
@@ -442,17 +454,18 @@
 			   (car fldgrp)))
 	 (setq dir (mew-expand-folder fld))
 	 (unless (file-directory-p dir)
-	   (mew-make-directory dir))
+	   (mew-make-directory dir)
+	   (setq newfld t))
 	 (mew-shimbun-visit-folder fld)
 	 (sit-for 0.5)
 	 (mew-rendezvous mew-summary-buffer-process)
-	 (mew-shimbun-retrieve)
+	 (mew-shimbun-retrieve newfld)
 	 (unless (eq (get-buffer cfld) (current-buffer))
 	   (mew-kill-buffer (current-buffer)))))
      (mew-shimbun-visit-folder cfld)
      (message "Getting done"))))
 
-(defun mew-shimbun-retrieve-article (mua server group range fld)
+(defun mew-shimbun-retrieve-article (mua server group range fld &optional newfld)
   "Retrieve articles via SHIMBUN."
   (luna-define-method shimbun-mua-search-id ((mua shimbun-mew-mua) id)
     (let ((shimbun (shimbun-mua-shimbun mua)))
@@ -468,7 +481,7 @@
 		  mew-use-biff))
 	(count 0)
 	(dispcount 0)
-	newfld msg file)
+	msg file)
     (if biff (mew-biff-clean-up))
     (shimbun-open-group shimbun group)
     (unless (file-exists-p (mew-expand-folder fld))
@@ -501,7 +514,7 @@
 		    (insert (format "X-Shimbun-Id: %s\n" id))
 		    (mew-shimbun-sanity-convert)
 		    (setq msg (mew-folder-new-message fld 'numonly))
-		    (setq file (mew-expand-folder fld msg))
+		    (setq file (mew-shimbun-expand-msg fld msg))
 		    (mew-frwlet
 		     mew-cs-dummy mew-cs-text-for-write
 		     (write-region (point-min) (point-max) file nil 'nomsg))
@@ -662,7 +675,7 @@
 		  (setq newcount (1+ newcount))
 		  (setq msg (mew-folder-new-message fld 'numonly))
 		  (setq oldmd5 nil))
-		(setq file (mew-expand-folder fld msg))
+		(setq file (mew-shimbun-expand-msg fld msg))
 		(setq buf (get-buffer-create mew-shimbun-article-buffer-name))
 		(with-current-buffer buf
 		  (mew-erase-buffer)
@@ -790,7 +803,7 @@
 		     (mew-elet
 		      (delete-region (point)
 				     (progn (forward-line) (point)))))
-		   (setq file (mew-expand-folder fld msg))
+		   (setq file (mew-shimbun-expand-msg fld msg))
 		   (when (and (file-exists-p file)
 			      (file-readable-p file)
 			      (file-writable-p file))
@@ -1010,10 +1023,10 @@
 	(forward-line)
 	(mew-header-goto-next)
 	(delete-region beg (point)))
-      (mew-md5
-       (string-as-unibyte
-	(mew-buffer-substring (point-min)
-			      (min (point-max) (+ (point-min) 4096))))))))
+      (md5 (string-as-unibyte
+	    (mew-buffer-substring (point-min)
+				  (min (point-max) (+ (point-min) 4096))))
+	   nil nil 'binary))))
 
 (defvar mew-shimbun-touch-folder-p
   (static-if (boundp 'mew-touch-folder-p)