From fdc6d9fc09a76577ad80e07a5c8f0ebf33e03bd4 Mon Sep 17 00:00:00 2001 From: teranisi Date: Fri, 11 Feb 2005 12:52:50 +0000 Subject: [PATCH] Synch up with main trunk. --- NEWS | 3 +++ NEWS.ja | 3 +++ elmo/ChangeLog | 27 ++++++++++++++++++++++ elmo/elmo-imap4.el | 4 ++-- elmo/elmo-maildir.el | 63 +++++++++++++++++++++++++++++++++++++++----------- wl/ChangeLog | 10 ++++++++ wl/wl-summary.el | 20 ++++++++-------- wl/wl-template.el | 2 ++ 8 files changed, 106 insertions(+), 26 deletions(-) diff --git a/NEWS b/NEWS index e7d8597..584aad1 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,9 @@ Wanderlust NEWS -- User-visible changes in Wanderlust. * Changes in 2.12.1 from 2.12.0 Version 2.12.1 is a bug fix version of 2.12.0. +** Now Maildir is usable on Windows systems. + Note that it does not conform to the Maildir standard. + ** Fixed the problem in display module for IMAP messages. Now partially fetched messages are displayed correctly. If a message included child messages, their headers were not displayed. diff --git a/NEWS.ja b/NEWS.ja index 0422c3d..8ca2cd8 100644 --- a/NEWS.ja +++ b/NEWS.ja @@ -3,6 +3,9 @@ Wanderlust NEWS (日本語版) -- User-visible changes in Wanderlust. * 2.12.0 から 2.12.1 への変更点 2.12.1 は、2.12.0 のバグ修正版です。 +** Windows で Maildir が使えるようになりました。 + ただし、規格に則っていませんので、UNIX 上の Maildir と互換性がありません。 + ** 入れ子になったメッセージの IMAP による表示時の不具合が解消されました。 入れ子になったメッセージをパートフェッチした場合、ヘッダが表示されない 場合がありましたが、正しく表示されるようになりました。 diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 054316b..50d2fe6 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,30 @@ +2005-02-11 Yuuichi Teranishi + + * elmo-maildir.el (elmo-maildir-separator): Added some OS types + to the check logic of file systems which are weak in colon character. + +2005-02-11 Hiroya Murata + + * elmo-maildir.el (elmo-maildir-move-file): Simplify. + +2005-02-10 Yuuichi Teranishi + + * elmo-maildir.el (elmo-maildir-move-file): New function. + (elmo-folder-append-buffer): Use it. + (elmo-folder-append-messages): Ditto. + (These changes are based on Ron Isaacson's patch [wl-en: 01205]) + + * elmo-imap4.el (elmo-imap4-decode-folder-string): Call `utf7-decode'. + (elmo-imap4-encode-folder-string): Call `utf7-encode'. + + * elmo-maildir.el (elmo-maildir-separator): New user option. + (elmo-maildir-adjust-separator): New macro. + (elmo-maildir-list-location): Use it. + (elmo-maildir-update-current): Ditto. + (elmo-maildir-set-mark): Ditto. + (elmo-maildir-delete-mark): Ditto. + (These changes are based on Hiroya Murata's patch [wl: 13437]) + 2005-02-06 Hiroya Murata * elmo-nntp.el (elmo-nntp-server-command-index): Add entry `xhdr'. diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index cc1d40a..c3b88af 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -214,12 +214,12 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (defsubst elmo-imap4-decode-folder-string (string) (if elmo-imap4-use-modified-utf7 - (utf7-decode-string string 'imap) + (utf7-decode string 'imap) string)) (defsubst elmo-imap4-encode-folder-string (string) (if elmo-imap4-use-modified-utf7 - (utf7-encode-string string 'imap) + (utf7-encode string 'imap) string)) ;;; Response diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 4fb0dd0..c9347e2 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -45,6 +45,22 @@ (unread ?S 'remove) (answered ?R))) +(defcustom elmo-maildir-separator + (if (memq system-type + '(windows-nt OS/2 emx ms-dos win32 w32 mswindows cygwin)) + ?\- ?:) + "Character separating the id section from the flags section. +According to the maildir specification, this should be a colon (?:), +but some file systems don't support colons in filenames." + :type 'character + :group 'elmo) + +(defmacro elmo-maildir-adjust-separator (string) + `(if (= elmo-maildir-separator ?:) + ,string + (elmo-replace-in-string + ,string ":" (char-to-string elmo-maildir-separator)))) + ;;; ELMO Maildir folder (eval-and-compile (luna-define-class elmo-maildir-folder @@ -101,7 +117,9 @@ LOCATION." (setq locations (mapcar (lambda (x) - (if (string-match "^\\([^:]+\\):\\([^:]+\\)$" x) + (if (string-match + (elmo-maildir-adjust-separator "^\\([^:]+\\):\\([^:]+\\)$") + x) (progn (setq sym (elmo-match-string 1 x) flag-list (string-to-char-list @@ -260,14 +278,18 @@ LOCATION." (expand-file-name (car news) (expand-file-name "new" maildir)) (expand-file-name (concat (car news) - (unless (string-match ":2,[A-Z]*$" (car news)) - ":2,")) + (unless (string-match + (elmo-maildir-adjust-separator ":2,[A-Z]*$") + (car news)) + (elmo-maildir-adjust-separator ":2,"))) (expand-file-name "cur" maildir))) (setq news (cdr news))))) (defun elmo-maildir-set-mark (filename mark) "Mark the FILENAME file in the maildir. MARK is a character." - (if (string-match "^\\([^:]+:[12],\\)\\(.*\\)$" filename) + (if (string-match + (elmo-maildir-adjust-separator "^\\([^:]+:[12],\\)\\(.*\\)$") + filename) (let ((flaglist (string-to-char-list (elmo-match-string 2 filename)))) (unless (memq mark flaglist) @@ -277,12 +299,15 @@ LOCATION." (char-list-to-string flaglist))))) ;; Rescue no info file in maildir. (rename-file filename - (concat filename ":2," (char-to-string mark)))) + (concat filename + (elmo-maildir-adjust-separator ":2,") + (char-to-string mark)))) t) (defun elmo-maildir-delete-mark (filename mark) "Mark the FILENAME file in the maildir. MARK is a character." - (if (string-match "^\\([^:]+:2,\\)\\(.*\\)$" filename) + (if (string-match (elmo-maildir-adjust-separator "^\\([^:]+:2,\\)\\(.*\\)$") + filename) (let ((flaglist (string-to-char-list (elmo-match-string 2 filename)))) (when (memq mark flaglist) @@ -392,6 +417,23 @@ file name for maildir directories." basedir))) filename)) +(defun elmo-maildir-move-file (src dst) + (or (condition-case nil + (progn + ;; 1. Try add-link-to-file, then delete the original. + ;; This is safe on NFS. + (add-name-to-file src dst) + (ignore-errors + ;; It's ok if the delete-file fails; + ;; elmo-maildir-cleanup-temporal will catch it later. + (delete-file src)) + t) + (error)) + ;; 2. Even on systems with hardlinks, some filesystems (like AFS) + ;; might not support them, so fall back on rename-file. This is + ;; our best shot at atomic when add-name-to-file fails. + (rename-file src dst))) + (luna-define-method elmo-folder-append-buffer ((folder elmo-maildir-folder) &optional flags number) (let ((basedir (elmo-maildir-folder-directory-internal folder)) @@ -405,10 +447,7 @@ file name for maildir directories." (copy-to-buffer dst-buf (point-min) (point-max))) (as-binary-output-file (write-region (point-min) (point-max) filename nil 'no-msg)) - ;; add link from new. - ;; Some filesystem (like AFS) does not have hard-link. - ;; So we use elmo-copy-file instead of elmo-add-name-to-file here. - (elmo-copy-file + (elmo-maildir-move-file filename (expand-file-name (concat "new/" (file-name-nondirectory filename)) @@ -462,9 +501,7 @@ file name for maildir directories." (elmo-copy-file (elmo-message-file-name src-folder number) filename) - ;; Some filesystem (like AFS) does not have hard-link. - ;; So we use elmo-copy-file instead of elmo-add-name-to-file here. - (elmo-copy-file + (elmo-maildir-move-file filename (expand-file-name (concat "new/" (file-name-nondirectory filename)) diff --git a/wl/ChangeLog b/wl/ChangeLog index 55f1eb5..ad3913c 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,13 @@ +2005-02-11 Hiroya Murata + + * wl-summary.el (wl-summary-save): Use `write-region-as-binary' + instead of `write-region' and simplify. + +2005-02-09 Hiroya Murata + + * wl-template.el (wl-template-select): Cause error if + `wl-template-alist' is nil. + 2005-02-06 TAKAHASHI Kaoru * wl-news.el.in: Set file variable `no-byte-compile'. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index e0c31be..755d1e0 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -4708,25 +4708,23 @@ If ARG is numeric number, decode message as following: (interactive) (let ((filename) (num (wl-summary-message-number))) - (if (null wl-save-dir) - (setq wl-save-dir wl-temporary-file-directory)) + (unless wl-save-dir + (setq wl-save-dir wl-temporary-file-directory)) (if num (save-excursion (setq filename (expand-file-name (concat (int-to-string num) wl-summary-save-file-suffix) wl-save-dir)) - (if (null (and arg - (null (file-exists-p filename)))) - (setq filename - (read-file-name "Save to file: " filename))) - + (when (or (null arg) + (file-exists-p filename)) + (setq filename (read-file-name "Save to file: " filename))) (wl-summary-set-message-buffer-or-redisplay) (set-buffer (wl-message-get-original-buffer)) - (if (and (null arg) (file-exists-p filename)) - (if (y-or-n-p "File already exists. override it? ") - (write-region (point-min) (point-max) filename)) - (write-region (point-min) (point-max) filename))) + (when (or arg + (not (file-exists-p filename)) + (y-or-n-p "File already exists. override it? ")) + (write-region-as-binary (point-min) (point-max) filename))) (message "No message to save.")) num)) diff --git a/wl/wl-template.el b/wl/wl-template.el index 21c106d..b1f9230 100644 --- a/wl/wl-template.el +++ b/wl/wl-template.el @@ -93,6 +93,8 @@ Entering WL-Template mode calls the value of `wl-template-mode-hook'." (defun wl-template-select (&optional arg) "Select template from `wl-template-alist'." (interactive "P") + (unless wl-template-alist + (error "Please set `wl-template-alist'")) (if (not (if arg (not wl-template-visible-select) wl-template-visible-select)) -- 1.7.10.4