[Mew-dist 14097] Autodetecting mew-touch-folder-p.

Shuichi KITAGUCHI ( 北口修一 ) kit at example.com
2000年 9月 15日 (金) 17:12:31 JST


北口です。

mew-touch-folder-p を静的で設定するのではなく、起動時に自動判別する
ようにしてみました(単に ~/Mail/.mew-touch を作成してみて、その前後で
~/Mail の時刻を比較するだけですが)。これで、

  UNIX なんだけど ~/Mail は msdosfs 上にある
  NT なんだけど ~/Mail は FAT 上にある

というような状態も自動的に判別できるかと思います。

ただ、自動判別するとマズい場合があるかどうかが、ちょっと心配です。


--
Shuichi Kitaguchi <kit at example.com>
-------------- next part --------------
Index: mew-os2.el
===================================================================
RCS file: /usr/local/cvsroot/mew/mew-os2.el,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 mew-os2.el
--- mew-os2.el	2000/09/14 16:23:42	1.1.1.4
+++ mew-os2.el	2000/09/15 07:19:47
@@ -78,7 +78,6 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; misc
 
-(setq mew-touch-folder-p t)
 ;; Perl
 (setenv "PERL_BADLANG" "0")
 (setenv "PERL_BADFREE" "0")
Index: mew-vars.el
===================================================================
RCS file: /usr/local/cvsroot/mew/mew-vars.el,v
retrieving revision 1.1.1.22
diff -u -r1.1.1.22 mew-vars.el
--- mew-vars.el	2000/09/04 14:13:45	1.1.1.22
+++ mew-vars.el	2000/09/15 07:19:40
@@ -1010,11 +1010,9 @@
   :group 'mew-folder
   :type '(repeat string))
 
-(defcustom mew-touch-folder-p nil
+(defvar mew-touch-folder-p nil
   "*If non-nil, 'mew-summary-touch-file' is used to store
-time-stamp of a directory"
-  :group 'mew-folder
-  :type 'boolean)
+time-stamp of a directory")
 
 (defvar mew-dir-list-function (if (or (memq system-type '(OS/2 emx))
 				      (eq system-type 'windows-nt))
Index: mew-win32.el
===================================================================
RCS file: /usr/local/cvsroot/mew/mew-win32.el,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 mew-win32.el
--- mew-win32.el	2000/08/19 12:53:08	1.1.1.4
+++ mew-win32.el	2000/09/15 07:19:17
@@ -17,10 +17,6 @@
 ;;  ~/.emacs settings
 ;;
 
-;;; for Windows NT with NTFS
-;;(eval-after-load "mew-win32"
-;;  '(setq mew-touch-folder-p nil))
-
 ;;; for PRINTING
 ;;    mew-w32-prog-print     ...  print command
 ;;    mew-w32-prog-print-arg ...  print command argument
@@ -99,7 +95,6 @@
 ;; common programs.
 (setq mew-prog-shell        shell-file-name)
 
-(setq mew-touch-folder-p    t)
 (setq mew-delete-temp-file  nil)
 
 (setq mew-prog-text/html     mew-w32-exec)
Index: mew.el
===================================================================
RCS file: /usr/local/cvsroot/mew/mew.el,v
retrieving revision 1.1.1.29
diff -u -r1.1.1.29 mew.el
--- mew.el	2000/09/14 16:23:45	1.1.1.29
+++ mew.el	2000/09/15 07:44:40
@@ -172,6 +172,25 @@
        ;; cause an error again
        (error "Mew found some errors above.")))))
 
+(defun mew-touch-foler-check ()
+  "Create dummy file and check modification of directory timestamps.
+If operating system cannot update directory timestamp,
+set mew-touch-folder-p to t"
+  (interactive)
+  (let ((file (expand-file-name mew-summary-touch-file mew-conf-path))
+	(dir (mew-file-get-time (expand-file-name mew-conf-path)))
+	(mdir))
+    (progn
+      (if (file-writable-p file)
+	  (progn
+	    (write-region "touched by Mew.(test)" nil file nil 'no-msg)
+	    (delete-file file)))
+      (setq mdir (mew-file-get-time (expand-file-name mew-conf-path)))
+      (if (and (= (nth 0 dir) (nth 0 mdir))
+	       (= (nth 1 dir) (nth 1 mdir)))
+	  ;; this system cannot update directory timestamp.
+	  (setq mew-touch-folder-p t)))))
+
 (defun mew-status-update (arg)
   "Read Addrbook and update its information. If executed with '\\[universal-argument]',
 information of folders is also updated in addition to that of
@@ -183,6 +202,7 @@
   (if arg (mew-folder-setup (interactive-p)))
   (mew-folder-init mew-basic-folders)
   (mew-folder-init mew-inbox-folders)
+  (mew-touch-folder-check)
   (mew-regex-setup)
   (mew-addrbook-setup)
   (mew-pgp-setup)


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