[mew-dist 26469] Re: spotlight

Hideyuki SHIRAI ( 白井秀行 ) shirai at example.com
2005年 7月 6日 (水) 15:50:56 JST


白井です。Spotlight が動く OS は持っていないのですが。。。

From: Kazu Yamamoto (山本和彦) <kazu at example.com> さん曰く
Subject: [mew-dist 26465] spotlight
Message-ID: <20050705.130152.194023284.kazu at example.com>
Date: Tue, 05 Jul 2005 13:01:52 +0900 (JST)

> 検索強化月刊の一環で、Spotlight の機能を commit しました。

> 2) CVS Head の Mew を立ち上げると、自動的にディレクトリを移動させます。

--- mew.el	5 Jul 2005 03:36:16 -0000	1.267
+++ mew.el	6 Jul 2005 06:40:23 -0000

-  '(("+.pop" "+#pop") ("+.imap" "+#imap") ("+.imap" "+#nntp")))
+  '(("+.pop" "+#pop") ("+.imap" "+#imap") ("+.nntp" "+#nntp")))

# これ、すさまじく悩んでしまった :-)

もとのディレクトリが移動したので、Namazu の index も移動して、中
身を更新しないといけません。mew-transit-folder() を呼んでいるタ
イミングで、mew-nmz-transit-folder() を呼ぶと index も自動で更新
されます。一発 mew-nmz-transit-folder() を動かすだけでも良いです
が。。。

# 使っている人には、すでに遅いかな。

(defun mew-nmz-transit-folder ()
  (let ((alist mew-transit-folder-alist)
	ent olddir newdir oldnmz newnmz
	dirs subold subnew)
    (with-temp-buffer
      (while alist
	(setq ent (car alist))
	(setq alist (cdr alist))
	(setq oldnmz (mew-nmz-expand-folder (nth 0 ent)))
	(setq newnmz (mew-nmz-expand-folder (nth 1 ent)))
	(setq olddir (mew-expand-folder (nth 0 ent)))
	(setq newdir (mew-expand-folder (nth 1 ent)))
	(when (and (file-directory-p oldnmz) (not (file-exists-p newnmz)))
	  (rename-file oldnmz newnmz)
	  (cd newnmz)
	  (setq dirs (directory-files "."))
	  (while dirs
	    (setq subold (car dirs))
	    (setq dirs (cdr dirs))
	    ;; % is a special character for URL.
	    ;; And "open" does not convert % to %25, sigh.
	    (when (string-match "@[^%]+\\(%\\)" subold)
	      (setq subnew (copy-sequence subold))
	      (aset subnew (match-beginning 1) ?#)
	      (rename-file subold subnew)
	      (mew-nmz-transit-folder-uri (expand-file-name subnew newnmz)
					  (expand-file-name subold olddir)
					  (expand-file-name subnew newdir)))))))))

(defun mew-nmz-transit-folder-uri (dir old new)
  (when mew-nmz-use-drive-letter
    (when (string-match "^\\([a-zA-Z]\\):\\(/.*\\)" old)
      (setq old (concat "/"
			(substring old (match-beginning 1) (match-end 1))
			"|"
			(substring old (match-beginning 2) (match-end 2)))))
    (when (string-match "^\\([a-zA-Z]\\):\\(/.*\\)" new)
      (setq new (concat "/"
			(substring new (match-beginning 1) (match-end 1))
			"|"
			(substring new (match-beginning 2) (match-end 2))))))
  (mew-nmz-folder-reindex-recursively dir old new))

## あと思うところもあるのだけど、それは別便で。

-- 
白井秀行 (mailto:shirai at example.com)



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