From 27f6e9f26b674b06d4ea0c771f9fe171a764237a Mon Sep 17 00:00:00 2001 From: hmurata Date: Sun, 14 Sep 2003 16:31:49 +0000 Subject: [PATCH] * wl-draft.el (wl-draft-previous-history-element): Fixed 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 | 9 ++++ elmo/elmo-msgdb.el | 125 ++++++++++++++++------------------------------------ elmo/elmo.el | 10 ++--- wl/ChangeLog | 5 +++ wl/wl-draft.el | 4 +- 5 files changed, 58 insertions(+), 95 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index e55681e..29fa573 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,14 @@ 2003-09-14 Hiroya Murata + * 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'. diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index a5a5b90..e75431d 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -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 () diff --git a/elmo/elmo.el b/elmo/elmo.el index 2831c04..fea0a82 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -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) ;; diff --git a/wl/ChangeLog b/wl/ChangeLog index 1088233..e9eb793 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,8 @@ +2003-09-14 Hiroya Murata + + * wl-draft.el (wl-draft-previous-history-element): Fixed + unbalanced parenthesis and bind unbound local variables. + 2003-09-14 Yoichi NAKAYAMA * wl-draft.el (wl-draft-previous-history-element): New function. diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 6df2d19..5e2f5d7 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -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") -- 1.7.10.4