* wl-draft.el (wl-draft-previous-history-element): Fixed
authorhmurata <hmurata>
Sun, 14 Sep 2003 16:31:49 +0000 (16:31 +0000)
committerhmurata <hmurata>
Sun, 14 Sep 2003 16:31:49 +0000 (16:31 +0000)
unbalanced parenthesis and bind unbound local variables.

* elmo.el (elmo-message-cached-p): Use `elmo-message-flagged-p'
instead of `elmo-msgdb-get-cached'.
(elmo-message-set-cached): Don't use `elmo-msgdb-set-cached'.

* elmo-msgdb.el (elmo-msgdb-get-cached): Abolish.
(elmo-msgdb-set-cached): Ditto.
(elmo-msgdb-set-flag): Rewrite.
(elmo-msgdb-unset-flag): Ditto.

elmo/ChangeLog
elmo/elmo-msgdb.el
elmo/elmo.el
wl/ChangeLog
wl/wl-draft.el

index e55681e..29fa573 100644 (file)
@@ -1,5 +1,14 @@
 2003-09-14  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
+       * elmo.el (elmo-message-cached-p): Use `elmo-message-flagged-p'
+       instead of `elmo-msgdb-get-cached'.
+       (elmo-message-set-cached): Don't use `elmo-msgdb-set-cached'.
+
+       * elmo-msgdb.el (elmo-msgdb-get-cached): Abolish.
+       (elmo-msgdb-set-cached): Ditto.
+       (elmo-msgdb-set-flag): Rewrite.
+       (elmo-msgdb-unset-flag): Ditto.
+
        * elmo-msgdb.el: Rewrite with luna.
 
        * elmo.el (elmo-folder-msgdb-load): Renamed from `elmo-msgdb-load'.
index a5a5b90..e75431d 100644 (file)
@@ -419,101 +419,52 @@ if MARK is nil, mark is removed."
     ;; return value.
     t))
 
-(defun elmo-msgdb-get-cached (msgdb number)
-  "Return non-nil if message is cached."
-  (not (member (elmo-msgdb-get-mark msgdb number)
-              (elmo-msgdb-uncached-marks))))
-
-(defun elmo-msgdb-set-cached (msgdb number cached use-cache)
-  "Set message cache status.
-If mark is changed, return non-nil."
-  (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
-        (cur-flag (cond
-                     ((string= cur-mark elmo-msgdb-important-mark)
-                      'important)
-                     ((member cur-mark (elmo-msgdb-answered-marks))
-                      'answered)
-                     ((not (member cur-mark (elmo-msgdb-unread-marks)))
-                      'read)))
-        (cur-cached (elmo-file-cache-exists-p
-                     (elmo-msgdb-get-field msgdb number 'message-id))))
-    (unless (eq cached cur-cached)
-      (case cur-flag
-       (read
-        (elmo-msgdb-set-mark msgdb number
-                             (if (and use-cache (not cached))
-                                 elmo-msgdb-read-uncached-mark)))
-       (important nil)
-       (answered
-        (elmo-msgdb-set-mark msgdb number
-                             (if cached
-                                 elmo-msgdb-answered-cached-mark
-                               elmo-msgdb-answered-uncached-mark)))
-       (t
-        (elmo-msgdb-set-mark msgdb number
-                             (if cached
-                                 elmo-msgdb-unread-cached-mark
-                               elmo-msgdb-unread-uncached-mark)))))))
-
 (luna-define-method elmo-msgdb-flags ((msgdb elmo-msgdb-legacy) number)
   (elmo-msgdb-mark-to-flags (elmo-msgdb-get-mark msgdb number)))
 
 (luna-define-method elmo-msgdb-set-flag ((msgdb elmo-msgdb-legacy)
                                         number flag)
-  (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
-        (cur-flag (cond
-                   ((string= cur-mark elmo-msgdb-important-mark)
-                    'important)
-                   ((member cur-mark (elmo-msgdb-answered-marks))
-                    'answered)
-                   ((not (member cur-mark (elmo-msgdb-unread-marks)))
-                    'read)))
-        (cur-cached (elmo-file-cache-exists-p
-                     (elmo-msgdb-get-field msgdb number 'message-id))))
-    (case flag
-      (read
-       (case cur-flag
-        ((read important)) ; answered mark is overriden.
-        (t (elmo-msgdb-set-mark msgdb number
-                                (if (not cur-cached)
-                                    elmo-msgdb-read-uncached-mark)))))
-      (important
-       (unless (eq cur-flag 'important)
-        (elmo-msgdb-set-mark msgdb number elmo-msgdb-important-mark)))
-      (answered
-       (unless (or (eq cur-flag 'answered) (eq cur-flag 'important))
-        (elmo-msgdb-set-mark msgdb number
-                             (if cur-cached
-                                 elmo-msgdb-answered-cached-mark
-                               elmo-msgdb-answered-uncached-mark)))))))
+  (case flag
+    (read
+     (elmo-msgdb-unset-flag msgdb number 'unread))
+    (uncached
+     (elmo-msgdb-unset-flag msgdb number 'cached))
+    (t
+     (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
+           (flags (elmo-msgdb-mark-to-flags cur-mark))
+           new-mark)
+       (and (memq 'new flags)
+           (setq flags (delq 'new flags)))
+       (or (memq flag flags)
+          (setq flags (cons flag flags)))
+       (when (and (eq flag 'unread)
+                 (memq 'answered flags))
+        (setq flags (delq 'answered flags)))
+       (setq new-mark (elmo-msgdb-flags-to-mark flags))
+       (unless (string= new-mark cur-mark)
+        (elmo-msgdb-set-mark msgdb number new-mark))))))
 
 (luna-define-method elmo-msgdb-unset-flag ((msgdb elmo-msgdb-legacy)
                                           number flag)
-  (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
-        (cur-flag (cond
-                   ((string= cur-mark elmo-msgdb-important-mark)
-                    'important)
-                   ((member cur-mark (elmo-msgdb-answered-marks))
-                    'answered)
-                   ((not (member cur-mark (elmo-msgdb-unread-marks)))
-                    'read)))
-        (cur-cached (elmo-file-cache-exists-p
-                     (elmo-msgdb-get-field msgdb number 'message-id))))
-    (case flag
-      (read
-       (when (or (eq cur-flag 'read) (eq cur-flag 'answered))
-        (elmo-msgdb-set-mark msgdb number
-                             (if cur-cached
-                                 elmo-msgdb-unread-cached-mark
-                               elmo-msgdb-unread-uncached-mark))))
-      (important
-       (when (eq cur-flag 'important)
-        (elmo-msgdb-set-mark msgdb number nil)))
-      (answered
-       (when (eq cur-flag 'answered)
-        (elmo-msgdb-set-mark msgdb number
-                             (if (not cur-cached)
-                                 elmo-msgdb-read-uncached-mark)))))))
+  (case flag
+    (read
+     (elmo-msgdb-set-flag msgdb number 'unread))
+    (uncached
+     (elmo-msgdb-set-flag msgdb number 'cached))
+    (t
+     (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
+           (flags (elmo-msgdb-mark-to-flags cur-mark))
+           new-mark)
+       (and (memq 'new flags)
+           (setq flags (delq 'new flags)))
+       (and (memq flag flags)
+           (setq flags (delq flag flags)))
+       (when (and (eq flag 'unread)
+                 (memq 'answered flags))
+        (setq flags (delq 'answered flags)))
+       (setq new-mark (elmo-msgdb-flags-to-mark flags))
+       (unless (string= new-mark cur-mark)
+        (elmo-msgdb-set-mark msgdb number new-mark))))))
 
 (defvar elmo-msgdb-unread-marks-internal nil)
 (defsubst elmo-msgdb-unread-marks ()
index 2831c04..fea0a82 100644 (file)
@@ -1108,7 +1108,7 @@ NUMBERS is a list of message numbers, messages are searched from the list."
   "Return non-nil if the message is cached.")
 
 (luna-define-method elmo-message-cached-p ((folder elmo-folder) number)
-  (elmo-msgdb-get-cached (elmo-folder-msgdb folder) number))
+  (elmo-message-flagged-p folder number 'cached))
 
 (defun elmo-message-accessible-p (folder number)
   "Get accessibility of the message.
@@ -1125,11 +1125,9 @@ If CACHED is t, message is set as cached.")
 
 (luna-define-method elmo-message-set-cached ((folder elmo-folder)
                                             number cached)
-  (when (elmo-msgdb-set-cached (elmo-folder-msgdb folder)
-                              number
-                              cached
-                              (elmo-message-use-cache-p folder number))
-    (elmo-folder-set-mark-modified-internal folder t)))
+  (if cached
+      (elmo-msgdb-set-flag (elmo-folder-msgdb folder) number 'cached)
+    (elmo-msgdb-unset-flag (elmo-folder-msgdb folder) number 'cached)))
 
 (defun elmo-message-copy-entity (entity)
   ;; 
index 1088233..e9eb793 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-14  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * wl-draft.el (wl-draft-previous-history-element): Fixed
+       unbalanced parenthesis and bind unbound local variables.
+
 2003-09-14  Yoichi NAKAYAMA  <yoichi@geiin.org>
 
        * wl-draft.el (wl-draft-previous-history-element): New function.
index 6df2d19..5e2f5d7 100644 (file)
@@ -2441,7 +2441,7 @@ Automatically applied in draft sending time."
 
 (defun wl-draft-previous-history-element (n)
   (interactive "p")
-  (let (bol history)
+  (let (bol history beg end prev new)
     (when (and (not (wl-draft-on-field-p))
               (< (point)
                  (save-excursion
@@ -2503,7 +2503,7 @@ Automatically applied in draft sending time."
             (delete-region (match-beginning 1) (match-end 1))
             (insert (car history)))
            (t
-            (setq wl-draft-current-history-position nil)))))))
+            (setq wl-draft-current-history-position nil))))))
 
 (defun wl-draft-next-history-element (n)
   (interactive "p")