* wl.el (wl-init): Set `elmo-get-folder-function' as
authorhmurata <hmurata>
Sun, 12 Jun 2005 05:03:09 +0000 (05:03 +0000)
committerhmurata <hmurata>
Sun, 12 Jun 2005 05:03:09 +0000 (05:03 +0000)
`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.

15 files changed:
elmo/ChangeLog
elmo/elmo-access.el
elmo/elmo-dop.el
elmo/elmo-filter.el
elmo/elmo-flag.el
elmo/elmo-internal.el
elmo/elmo-multi.el
elmo/elmo-pipe.el
elmo/elmo-shimbun.el
elmo/elmo-split.el
elmo/elmo.el
wl/ChangeLog
wl/wl-folder.el
wl/wl-spam.el
wl/wl.el

index 9fe9b7c..3361380 100644 (file)
@@ -1,3 +1,40 @@
+2005-06-12  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * 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  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-util.el (elmo-collect-separators): New function.
index a071254..5f7e175 100644 (file)
 (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))
index 33de027..3c2d28d 100644 (file)
@@ -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)
index 8b56e66..74afbaf 100644 (file)
@@ -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
index c7b6b1d..7a64396 100644 (file)
                             (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?)
 (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.
index ab3bf94..afe65ab 100644 (file)
@@ -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))))
index ba0eaaa..12eb2c4 100644 (file)
@@ -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) ?,))
index cbf6330..af78ab5 100644 (file)
                                            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= ":"
   (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
                (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)
index da51154..49b1381 100644 (file)
@@ -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))
index 28bebd2..966e1d2 100644 (file)
@@ -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
index d1a2b2b..88a380d 100644 (file)
@@ -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)))
 
index 6ee1995..854c452 100644 (file)
@@ -1,3 +1,17 @@
+2005-06-12  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * 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  <lapis-lazuli@pop06.odn.ne.jp>
 
        * wl-mime.el (wl-message-verify-pgp-nonmime): Fix the last change.
index b0814b6..42bff15 100644 (file)
@@ -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
index 3d0b0be..8bb5494 100644 (file)
@@ -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)
index 5c88565..27a4702 100644 (file)
--- 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))