[Mew-dist 12038] mew-touch-folder patch.
Shuichi KITAGUCHI ( 北口修一 )
kit at example.com
2000年 1月 11日 (火) 22:45:57 JST
北口です。
Win95/98 でディレクトリの時刻を変更させようとすると不安定かつ遅く
なるということを身をもって実感したので、mew-touch-folder で
utime.exe を使わないようにしてみました。昔にも同じものがありましたが、
各フォルダに .mew-touch を作ってそれと .mew-cache の時刻を比較します。
# もちろん、mew-touch-folder-p が non-nil の時のみ。
これは utime.exe が動かないという人以外にも、
・refile の度に call-process するので遅い。
・FreeBSD 使ってるんだけど Mail folder は FAT 上にあるので、ディレクトリの
時刻が更新されなくて悲しい(Linux は知らないので...)。
という状況が改善されるという効能もあります。
ただし、(前からそうなんですが)Mail folder が NTFS 上にある
人は必要ありませんので、~/.emacs に
(eval-after-load "mew-win32")
'(setq mew-touch-folder-p nil))
とか、~/.mew(.el) に
(setq mew-touch-folder-p nil)
とかするとよいでしょう。
それと、白井さんによる IM へのパッチも付けておきます。~/.im/Config に
UseTouchFile=on
と書くと Mew へのパッチ同様に .mew-touch を作るようになります。
# 時期が時期だけに、IM にパッチを当てるべきか難しいところですが。
ただ、OS/2 の方にも影響が出ますので、OS/2 な方の意見をお聞きしたいです。
P.S.
ファイルシステムに依存されるとちょっとつらいです...
--
Shuichi Kitaguchi <kit at example.com>
-------------- next part --------------
? mew.diff
Index: mew-func.el
===================================================================
RCS file: /usr/local/CVS/mew/mew-func.el,v
retrieving revision 1.1.1.14
diff -c -r1.1.1.14 mew-func.el
*** mew-func.el 1999/12/28 13:08:05 1.1.1.14
--- mew-func.el 2000/01/11 13:26:17
***************
*** 603,610 ****
(file-error folders))))
(defun mew-touch-folder (fld)
! (if (and mew-touch-folder-p (mew-which-exec mew-prog-utime))
! (call-process mew-prog-utime nil nil nil (mew-expand-folder fld))))
;;
;; Directory
--- 603,613 ----
(file-error folders))))
(defun mew-touch-folder (fld)
! (if (and mew-touch-folder-p (stringp mew-summary-touch-file))
! (let ((file (expand-file-name mew-summary-touch-file
! (mew-expand-folder fld))))
! (if (file-writable-p file)
! (write-region (point-min) (point-min) file nil 'no-msg)))))
;;
;; Directory
Index: mew-scan.el
===================================================================
RCS file: /usr/local/CVS/mew/mew-scan.el,v
retrieving revision 1.1.1.13
diff -c -r1.1.1.13 mew-scan.el
*** mew-scan.el 1999/12/28 13:08:07 1.1.1.13
--- mew-scan.el 2000/01/11 13:26:17
***************
*** 353,359 ****
(defun mew-summary-compare-times (type)
(let* ((dir (file-chase-links (mew-expand-folder (buffer-name))))
! (tdir (mew-file-get-time dir))
(cache (expand-file-name mew-summary-cache-file dir))
(tcache (mew-file-get-time cache))
(tbuf mew-summary-buffer-folder-cache-time)
--- 353,363 ----
(defun mew-summary-compare-times (type)
(let* ((dir (file-chase-links (mew-expand-folder (buffer-name))))
! (tdir (if mew-touch-folder-p
! (mew-file-get-time
! (expand-file-name mew-summary-touch-file
! (mew-expand-folder dir)))
! (mew-file-get-time dir)))
(cache (expand-file-name mew-summary-cache-file dir))
(tcache (mew-file-get-time cache))
(tbuf mew-summary-buffer-folder-cache-time)
Index: mew-vars.el
===================================================================
RCS file: /usr/local/CVS/mew/mew-vars.el,v
retrieving revision 1.1.1.15
diff -c -r1.1.1.15 mew-vars.el
*** mew-vars.el 1999/12/28 13:08:08 1.1.1.15
--- mew-vars.el 2000/01/11 13:26:17
***************
*** 512,517 ****
--- 512,520 ----
(defvar mew-summary-cache-file ".mew-cache"
"*Cache file for Summary mode contents.")
+ (defvar mew-summary-touch-file ".mew-touch"
+ "*Time-stamp file for message folders.")
+
(defvar mew-window-home-buffer "*scratch*"
"*Buffer name to return if window stack is empty.")
Index: mew-win32.el
===================================================================
RCS file: /usr/local/CVS/mew/mew-win32.el,v
retrieving revision 1.1.1.12
diff -c -r1.1.1.12 mew-win32.el
*** mew-win32.el 1999/12/11 11:40:55 1.1.1.12
--- mew-win32.el 2000/01/11 13:26:17
***************
*** 2,12 ****
;; Author: Shuichi Kitaguchi <kit at example.com>
;; Created: Dec 05, 1997
! ;; Revised: Nov 20, 1999
;;; Code:
! (defconst mew-win32-version "mew-win32.el 0.35")
;;; for NTEmacs User
;;
--- 2,12 ----
;; Author: Shuichi Kitaguchi <kit at example.com>
;; Created: Dec 05, 1997
! ;; Revised: Jan 11, 2000
;;; Code:
! (defconst mew-win32-version "mew-win32.el 0.36")
;;; for NTEmacs User
;;
***************
*** 17,22 ****
--- 17,26 ----
;; ~/.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
***************
*** 98,104 ****
;; common programs.
(setq mew-prog-shell shell-file-name)
- (setq mew-prog-utime "utime.exe")
(setq mew-touch-folder-p t)
(setq mew-delete-temp-file nil)
--- 102,107 ----
-------------- next part --------------
*** Config.pm.in.orig Wed Jan 5 18:09:01 2000
--- Config.pm.in Thu Jan 6 17:43:40 2000
***************
*** 42,48 ****
nntpservers nntphistoryfile nntpauthuser
popaccount pophistoryfile imapaccount httpproxy noproxy
usepwagent pwagentport usepwfiles pwfiles
! expand_path
pop_timeout imap_timeout nntp_timeout dns_timeout
connect_timeout command_timeout rcv_buf_siz
db_type file_attr);
--- 42,48 ----
nntpservers nntphistoryfile nntpauthuser
popaccount pophistoryfile imapaccount httpproxy noproxy
usepwagent pwagentport usepwfiles pwfiles
! expand_path usetouchfile touchfile
pop_timeout imap_timeout nntp_timeout dns_timeout
connect_timeout command_timeout rcv_buf_siz
db_type file_attr);
***************
*** 141,146 ****
--- 141,148 ----
'connecttimeout;i;60;ConnectTimeout' => 'Timeout for connection making',
'commandtimeout;i;300;CommandTimeout' => 'Timeout for each command',
'rcvbufsiz;i;;RcvBufSiz' => 'Receive buffer size of TCP',
+ 'usetouchfile;b;;UseTouchFile' => 'Use touch file',
+ 'touchfile;s;;TouchFile' => 'Touch file name',
);
# these vars should be in current package?
***************
*** 899,904 ****
--- 901,914 ----
return $PwFiles;
}
+ sub usetouchfile () {
+ return $UseTouchFile;
+ }
+
+ sub touchfile () {
+ return $TouchFile;
+ }
+
sub pop_timeout () {
return $PopTimeout;
}
***************
*** 1016,1021 ****
--- 1026,1033 ----
AddrBookFile=Addrbook # relative to ~/.im/
AliasesFile=Aliases # relative to ~/.im/
#PetnameFile=Petnames # relative to ~/.im/
+ UseTouchFile=off
+ TouchFile=.mew-touch
# imget/imls
Form=%+5n %m%d %-14A %S || %b # default format for scanning
Width=80 # default width for scanning
*** Folder.pm.orig Wed Jan 5 18:09:01 2000
--- Folder.pm Thu Jan 6 18:41:00 2000
***************
*** 14,20 ****
require 5.003;
require Exporter;
! use IM::Config qw(expand_path context_file inbox_folder folder_mode);
use IM::Util;
use integer;
use strict;
--- 14,20 ----
require 5.003;
require Exporter;
! use IM::Config qw(expand_path context_file inbox_folder folder_mode usetouchfile touchfile);
use IM::Util;
use integer;
use strict;
***************
*** 332,342 ****
}
sub touch_folder ($) {
! if (&win95p){
! my ($dir) = shift;
! $dir =~ s/\/\d+$//;
! $dir = &expand_path($dir);
! system "utime $dir";
} elsif (&os2p) {
my ($dir) = shift;
$dir =~ s/\/\d+$//;
--- 332,344 ----
}
sub touch_folder ($) {
! if (&usetouchfile()) {
! my ($dir) = shift;
! $dir =~ s/\/\d+$//;
! $dir = &expand_path($dir);
! my($file) = ($dir . "/" . &touchfile());
! open(OF,">$file");
! close(OF);
} elsif (&os2p) {
my ($dir) = shift;
$dir =~ s/\/\d+$//;
Mew-dist メーリングリストの案内