From 8b8f105e52cd4f1d2fc89dc09b462491721a878e Mon Sep 17 00:00:00 2001 From: hmurata Date: Sun, 12 Jun 2005 05:03:09 +0000 Subject: [PATCH] * wl.el (wl-init): Set `elmo-get-folder-function' as `wl-folder-make-elmo-folder'. * wl-spam.el (wl-summary-exec-action-spam): Use `wl-folder-make-elmo-folder' instead of `elmo-make-folder'. * wl-folder.el (wl-folder-make-elmo-folder): New function. (wl-draft-get-folder): Use `wl-folder-make-elmo-folder' instead of `elmo-make-folder'. (wl-folder-get-elmo-folder): Ditto. (wl-folder-create-subr): Simplify. * elmo.el (elmo-get-folder-function): New variable. (elmo-get-folder): New function. (elmo-folder-rename): Call `elmo-make-folder' with specified mime-charset. * elmo-split.el (elmo-split): Use `elmo-get-folder' instead of `elmo-make-folder'. (elmo-split-subr): Ditto. * elmo-multi.el (elmo-folder-initialize): Ditto. * elmo-internal.el (elmo-folder-list-subfolders): Ditto. * elmo-flag.el (elmo-flag-folder-delete-message): Ditto. (elmo-flag-get-folder): Ditto. * elmo-filter.el (elmo-folder-initialize): Ditto. * elmo-access.el (elmo-folder-initialize): Ditto. (elmo-access-folder-update-children): Ditto. * elmo-dop.el (elmo-dop-queue-flush): Ditto. (elmo-dop-queue-flush): Ditto. (elmo-folder-append-buffer-dop-delayed): Ditto. (elmo-dop-spool-folder): Call `elmo-make-folder' with specified mime-charset. * elmo-pipe.el (elmo-folder-initialize): Use `elmo-get-folder' instead of `elmo-make-folder'. (elmo-folder-rename): Ditto. Use `elmo-folder-rename' to destination folder instead of send `elmo-folder-rename-internal'. * elmo-shimbun.el (elmo-folder-list-subfolders): Use `shimbun' slot of subfolder instead of create it. --- elmo/ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ elmo/elmo-access.el | 6 +++--- elmo/elmo-dop.el | 17 +++++++++-------- elmo/elmo-filter.el | 2 +- elmo/elmo-flag.el | 4 ++-- elmo/elmo-internal.el | 4 ++-- elmo/elmo-multi.el | 2 +- elmo/elmo-pipe.el | 17 ++++++----------- elmo/elmo-shimbun.el | 11 +++-------- elmo/elmo-split.el | 4 ++-- elmo/elmo.el | 18 ++++++++++++++---- wl/ChangeLog | 14 ++++++++++++++ wl/wl-folder.el | 38 +++++++++++++++++--------------------- wl/wl-spam.el | 2 +- wl/wl.el | 1 + 15 files changed, 113 insertions(+), 64 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 9fe9b7c..3361380 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,40 @@ +2005-06-12 Hiroya Murata + + * elmo.el (elmo-get-folder-function): New variable. + (elmo-get-folder): New function. + (elmo-folder-rename): Call `elmo-make-folder' with specified + mime-charset. + + * elmo-split.el (elmo-split): Use `elmo-get-folder' instead of + `elmo-make-folder'. + (elmo-split-subr): Ditto. + + * elmo-multi.el (elmo-folder-initialize): Ditto. + + * elmo-internal.el (elmo-folder-list-subfolders): Ditto. + + * elmo-flag.el (elmo-flag-folder-delete-message): Ditto. + (elmo-flag-get-folder): Ditto. + + * elmo-filter.el (elmo-folder-initialize): Ditto. + + * elmo-access.el (elmo-folder-initialize): Ditto. + (elmo-access-folder-update-children): Ditto. + + * elmo-dop.el (elmo-dop-queue-flush): Ditto. + (elmo-dop-queue-flush): Ditto. + (elmo-folder-append-buffer-dop-delayed): Ditto. + (elmo-dop-spool-folder): Call `elmo-make-folder' with specified + mime-charset. + + * elmo-pipe.el (elmo-folder-initialize): Use `elmo-get-folder' + instead of `elmo-make-folder'. + (elmo-folder-rename): Ditto. Use `elmo-folder-rename' to + destination folder instead of send `elmo-folder-rename-internal'. + + * elmo-shimbun.el (elmo-folder-list-subfolders): Use `shimbun' + slot of subfolder instead of create it. + 2005-06-10 Hiroya Murata * elmo-util.el (elmo-collect-separators): New function. diff --git a/elmo/elmo-access.el b/elmo/elmo-access.el index a071254..5f7e175 100644 --- a/elmo/elmo-access.el +++ b/elmo/elmo-access.el @@ -42,10 +42,10 @@ (luna-define-method elmo-folder-initialize ((folder elmo-access-folder) name) (elmo-access-folder-set-base-folder-internal folder - (elmo-make-folder name)) + (elmo-get-folder name)) (elmo-multi-folder-set-children-internal folder - (mapcar #'elmo-make-folder + (mapcar #'elmo-get-folder (elmo-object-load (expand-file-name elmo-access-folder-list-filename (elmo-folder-msgdb-path folder))))) @@ -89,7 +89,7 @@ (if subfolders (nconc children (mapcar (lambda (name) - (let ((folder (elmo-make-folder name))) + (let ((folder (elmo-get-folder name))) (when open (elmo-folder-open-internal folder)) folder)) diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 33de027..3c2d28d 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -108,7 +108,7 @@ Saved queue is old version(2.6). Clear all pending operations? ") len) (while queue-all (if (elmo-folder-plugged-p - (elmo-make-folder (elmo-dop-queue-fname (car queue-all)))) + (elmo-get-folder (elmo-dop-queue-fname (car queue-all)))) (setq queue (append queue (list (car queue-all))))) (setq queue-all (cdr queue-all))) (setq count (length queue)) @@ -134,7 +134,7 @@ Saved queue is old version(2.6). Clear all pending operations? ") (apply (elmo-dop-queue-method (car queue)) (prog1 (setq folder - (elmo-make-folder + (elmo-get-folder (elmo-dop-queue-fname (car queue)))) (elmo-folder-open folder) (unless (elmo-folder-plugged-p folder) @@ -161,7 +161,7 @@ Saved queue is old version(2.6). Clear all pending operations? ") 'elmo-folder-append-buffer-dop-delayed) (elmo-folder-delete-messages (elmo-dop-spool-folder - (elmo-make-folder (elmo-dop-queue-fname (car queue)))) + (elmo-get-folder (elmo-dop-queue-fname (car queue)))) (list (nth 1 (elmo-dop-queue-arguments (car queue)))))) (setq elmo-dop-queue (delq (car queue) elmo-dop-queue)) (setq queue (cdr queue))) @@ -197,12 +197,13 @@ Saved queue is old version(2.6). Clear all pending operations? ") (setq elmo-dop-queue new-queue))) ;;; dop spool folder -(defmacro elmo-dop-spool-folder (folder) +(defsubst elmo-dop-spool-folder (folder) "Return a spool folder for disconnected operations which is corresponded to the FOLDER." - (` (elmo-make-folder - (concat "+" (expand-file-name "spool" (elmo-folder-msgdb-path - (, folder))))))) + (elmo-make-folder + (concat "+" (expand-file-name "spool" (elmo-folder-msgdb-path folder))) + nil + (elmo-folder-mime-charset-internal folder))) (defun elmo-dop-spool-folder-append-buffer (folder flags) "Append current buffer content to the dop spool folder. @@ -357,7 +358,7 @@ FOLDER is the folder structure." (error)) ;; Append failed... (elmo-folder-append-buffer - (elmo-make-folder elmo-lost+found-folder) + (elmo-get-folder elmo-lost+found-folder) flags)) (elmo-folder-delete-messages spool-folder (list number))))) ;; ignore failure (already dequed) diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 8b56e66..74afbaf 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -50,7 +50,7 @@ (if (string-match "^ */\\(.*\\)$" (cdr pair)) (elmo-filter-folder-set-target-internal folder - (elmo-make-folder (elmo-match-string 1 (cdr pair)))) + (elmo-get-folder (elmo-match-string 1 (cdr pair)))) (error "Folder syntax error `%s'" (elmo-folder-name-internal folder))) (elmo-filter-folder-set-require-msgdb-internal folder diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el index c7b6b1d..7a64396 100644 --- a/elmo/elmo-flag.el +++ b/elmo/elmo-flag.el @@ -153,7 +153,7 @@ (elmo-flag-folder-minfo-hash-internal folder)) (unless keep-referrer - (setq target-folder (elmo-make-folder (car pair))) + (setq target-folder (elmo-get-folder (car pair))) (elmo-folder-open target-folder 'load-msgdb) ;; Unset the flag of the original folder. ;; (XXX Should the message-id checked?) @@ -235,7 +235,7 @@ (defmacro elmo-flag-get-folder (flag) "Get the flag folder structure for FLAG." `(when (memq ,flag elmo-global-flags) - (elmo-make-folder (concat "'flag/" (symbol-name ,flag))))) + (elmo-get-folder (concat "'flag/" (symbol-name ,flag))))) (defun elmo-flag-folder-referrer (folder number) "Return a list of referrer message information. diff --git a/elmo/elmo-internal.el b/elmo/elmo-internal.el index ab3bf94..afe65ab 100644 --- a/elmo/elmo-internal.el +++ b/elmo/elmo-internal.el @@ -76,7 +76,7 @@ (lambda (x) (let ((name (concat (elmo-folder-prefix-internal folder) (symbol-name x)))) - (if (elmo-folder-have-subfolder-p (elmo-make-folder name)) + (if (elmo-folder-have-subfolder-p (elmo-get-folder name)) (list name) name))) elmo-internal-folder-list) @@ -85,7 +85,7 @@ (lambda (x) (let* ((name (concat (elmo-folder-prefix-internal folder) (symbol-name x))) - (subfolder (elmo-make-folder name))) + (subfolder (elmo-get-folder name))) (if (elmo-folder-have-subfolder-p subfolder) (elmo-folder-list-subfolders subfolder) (list name)))) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index ba0eaaa..12eb2c4 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -60,7 +60,7 @@ folder (nconc (elmo-multi-folder-children-internal folder) - (list (elmo-make-folder (car name))))) + (list (elmo-get-folder (car name))))) (setq name (cdr name)) (when (and (> (length name) 0) (eq (aref name 0) ?,)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index cbf6330..af78ab5 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -45,10 +45,10 @@ name) (when (string-match "^\\([^|]*\\)|\\(:?\\)\\(.*\\)$" name) (elmo-pipe-folder-set-src-internal folder - (elmo-make-folder + (elmo-get-folder (elmo-match-string 1 name))) (elmo-pipe-folder-set-dst-internal folder - (elmo-make-folder + (elmo-get-folder (elmo-match-string 3 name))) (elmo-pipe-folder-set-copy-internal folder (string= ":" @@ -306,7 +306,7 @@ (elmo-folder-pack-numbers (elmo-pipe-folder-dst-internal folder))) (luna-define-method elmo-folder-rename ((folder elmo-pipe-folder) new-name) - (let* ((new-folder (elmo-make-folder new-name))) + (let* ((new-folder (elmo-get-folder new-name))) (unless (string= (elmo-folder-name-internal (elmo-pipe-folder-src-internal folder)) (elmo-folder-name-internal @@ -317,14 +317,9 @@ (elmo-folder-type-internal (elmo-pipe-folder-dst-internal new-folder))) (error "Not same folder type")) - (if (or (file-exists-p (elmo-folder-msgdb-path - (elmo-pipe-folder-dst-internal new-folder))) - (elmo-folder-exists-p - (elmo-pipe-folder-dst-internal new-folder))) - (error "Already exists folder: %s" new-name)) - (elmo-folder-send (elmo-pipe-folder-dst-internal folder) - 'elmo-folder-rename-internal - (elmo-pipe-folder-dst-internal new-folder)) + (elmo-folder-rename (elmo-pipe-folder-dst-internal folder) + (elmo-folder-name-internal + (elmo-pipe-folder-dst-internal new-folder))) (elmo-msgdb-rename-path folder new-folder))) (luna-define-method elmo-folder-synchronize ((folder elmo-pipe-folder) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index da51154..49b1381 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -473,15 +473,10 @@ If it is the symbol `all', update overview for all shimbun folders." (setq folders (append folders (mapcar - (lambda (fld) (concat prefix server "." fld)) + (lambda (group) (concat prefix server "." group)) (shimbun-groups - (shimbun-open server - (let ((fld - (elmo-make-folder - (concat prefix server)))) - (luna-make-entity - 'shimbun-elmo-mua - :folder fld)))))))) + (elmo-shimbun-folder-shimbun-internal + (elmo-get-folder (concat prefix server)))))))) folders))))) (luna-define-method elmo-folder-exists-p ((folder elmo-shimbun-folder)) diff --git a/elmo/elmo-split.el b/elmo/elmo-split.el index 28bebd2..966e1d2 100644 --- a/elmo/elmo-split.el +++ b/elmo/elmo-split.el @@ -297,7 +297,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)." (fcount 0) ret) (dolist (folder folders) - (setq ret (elmo-split-subr (elmo-make-folder folder) arg) + (setq ret (elmo-split-subr (elmo-get-folder folder) arg) count (+ count (car ret)) fcount (+ fcount (cdr ret)))) (run-hooks 'elmo-split-hook) @@ -358,7 +358,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)." ((stringp action) (condition-case nil (progn - (setq target-folder (elmo-make-folder action)) + (setq target-folder (elmo-get-folder action)) (unless (elmo-folder-exists-p target-folder) (when (and diff --git a/elmo/elmo.el b/elmo/elmo.el index d1a2b2b..88a380d 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -190,6 +190,13 @@ encode and decode a multibyte string." (save-match-data (elmo-folder-send folder 'elmo-folder-initialize name)))) +(defvar elmo-get-folder-function nil) + +(defun elmo-get-folder (name) + (or (and elmo-get-folder-function + (funcall elmo-get-folder-function name)) + (elmo-make-folder name))) + ;; Note that this function is for internal use only. (luna-define-generic elmo-folder-msgdb (folder) "Return the msgdb of FOLDER (on-demand loading). @@ -777,13 +784,16 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).") t)) (luna-define-method elmo-folder-rename ((folder elmo-folder) new-name) - (let* ((new-folder (elmo-make-folder new-name))) + (let* ((new-folder (elmo-make-folder + new-name + nil + (elmo-folder-mime-charset-internal folder)))) (unless (eq (elmo-folder-type-internal folder) (elmo-folder-type-internal new-folder)) (error "Not same folder type")) - (if (or (file-exists-p (elmo-folder-msgdb-path new-folder)) - (elmo-folder-exists-p new-folder)) - (error "Already exists folder: %s" new-name)) + (when (or (file-exists-p (elmo-folder-msgdb-path new-folder)) + (elmo-folder-exists-p new-folder)) + (error "Already exists folder: %s" new-name)) (elmo-folder-send folder 'elmo-folder-rename-internal new-folder) (elmo-msgdb-rename-path folder new-folder))) diff --git a/wl/ChangeLog b/wl/ChangeLog index 6ee1995..854c452 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,17 @@ +2005-06-12 Hiroya Murata + + * wl.el (wl-init): Set `elmo-get-folder-function' as + `wl-folder-make-elmo-folder'. + + * wl-spam.el (wl-summary-exec-action-spam): Use + `wl-folder-make-elmo-folder' instead of `elmo-make-folder'. + + * wl-folder.el (wl-folder-make-elmo-folder): New function. + (wl-draft-get-folder): Use `wl-folder-make-elmo-folder' instead of + `elmo-make-folder'. + (wl-folder-get-elmo-folder): Ditto. + (wl-folder-create-subr): Simplify. + 2005-06-05 Hiroya Murata * wl-mime.el (wl-message-verify-pgp-nonmime): Fix the last change. diff --git a/wl/wl-folder.el b/wl/wl-folder.el index b0814b6..42bff15 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -336,10 +336,8 @@ Default HASHTB is `wl-folder-elmo-folder-hashtb'." (string= (elmo-folder-name-internal wl-draft-folder-internal) wl-draft-folder)) wl-draft-folder-internal - (setq wl-draft-folder-internal (elmo-make-folder - wl-draft-folder - nil - (wl-folder-mime-charset wl-draft-folder))) + (setq wl-draft-folder-internal (wl-folder-make-elmo-folder + wl-draft-folder)) (wl-folder-confirm-existence wl-draft-folder-internal) (elmo-folder-open wl-draft-folder-internal 'load-msgdb) wl-draft-folder-internal)) @@ -348,17 +346,18 @@ Default HASHTB is `wl-folder-elmo-folder-hashtb'." (or (wl-get-assoc-list-value wl-folder-mime-charset-alist folder-name) wl-mime-charset)) +(defun wl-folder-make-elmo-folder (folder-name) + (elmo-make-folder folder-name nil (wl-folder-mime-charset folder-name))) + (defsubst wl-folder-get-elmo-folder (entity &optional no-cache) "Get elmo folder structure from ENTITY." (let ((name (elmo-string entity))) (if no-cache - (elmo-make-folder name nil (wl-folder-mime-charset name)) + (wl-folder-make-elmo-folder name) (if (string= name wl-draft-folder) (wl-draft-get-folder) (or (wl-folder-elmo-folder-cache-get name) - (let ((folder (elmo-make-folder name - nil - (wl-folder-mime-charset name)))) + (let ((folder (wl-folder-make-elmo-folder name))) (wl-folder-elmo-folder-cache-put name folder) folder)))))) @@ -2895,19 +2894,16 @@ Call `wl-summary-write-current-folder' with current folder name." (kill-buffer bufname)))) (defun wl-folder-create-subr (folder) - (if (elmo-folder-creatable-p folder) - (if (y-or-n-p (format "Folder %s does not exist, create it? " - (elmo-folder-name-internal folder))) - (progn - (message "") - (setq wl-folder-entity-hashtb - (wl-folder-create-entity-hashtb - (elmo-folder-name-internal folder) - wl-folder-entity-hashtb)) - (unless (elmo-folder-create folder) - (error "Create folder failed"))) - (error "Folder %s is not created" (elmo-folder-name-internal folder))) - (error "Folder %s does not exist" (elmo-folder-name-internal folder)))) + (let ((name (elmo-folder-name-internal folder))) + (unless (elmo-folder-creatable-p folder) + (error "Folder %s does not exist" name)) + (unless (y-or-n-p (format "Folder %s does not exist, create it? " name)) + (error "Folder %s is not created" name)) + (message "") + (setq wl-folder-entity-hashtb + (wl-folder-create-entity-hashtb name wl-folder-entity-hashtb)) + (unless (elmo-folder-create folder) + (error "Create folder failed")))) (defun wl-folder-confirm-existence (folder &optional force) (if force diff --git a/wl/wl-spam.el b/wl/wl-spam.el index 3d0b0be..8bb5494 100644 --- a/wl/wl-spam.el +++ b/wl/wl-spam.el @@ -275,7 +275,7 @@ See `wl-summary-mark-action-list' for the detail of element." (let ((domain (wl-spam-domain (elmo-folder-name-internal wl-summary-buffer-elmo-folder))) (total (length mark-list))) - (wl-folder-confirm-existence (elmo-make-folder wl-spam-folder)) + (wl-folder-confirm-existence (wl-folder-get-elmo-folder wl-spam-folder)) (when (memq domain '(undecided good)) (message "Registering spam...") (elmo-with-progress-display (> total elmo-display-progress-threshold) diff --git a/wl/wl.el b/wl/wl.el index 5c88565..27a4702 100644 --- a/wl/wl.el +++ b/wl/wl.el @@ -718,6 +718,7 @@ Entering Plugged mode calls the value of `wl-plugged-mode-hook'." (make-face (intern (format "wl-highlight-summary-%s-flag-face" (car spec)))) (nth 1 spec))) + (setq elmo-get-folder-function #'wl-folder-make-elmo-folder) (setq elmo-no-from wl-summary-no-from-message) (setq elmo-no-subject wl-summary-no-subject-message) (elmo-global-flags-initialize (mapcar 'car wl-summary-flag-alist)) -- 1.7.10.4