From 29803299bf745cbf7f399be04d4c4b2998ad6a3c Mon Sep 17 00:00:00 2001 From: teranisi Date: Mon, 24 Mar 2003 04:32:38 +0000 Subject: [PATCH] Fixed last change. --- elmo/ChangeLog | 1 - elmo/elmo-msgdb.el | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 1d88d97..01e7161 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -3,7 +3,6 @@ * elmo.el (elmo-message-set-mark): Abolish. * elmo-msgdb.el (toplevel): Added comment. - (elmo-msgdb-set-mark): Abolish. (elmo-load-msgdb): Added 4th element `path'. (elmo-msgdb-append): Follow the change above. (elmo-msgdb-clear): Ditto. diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index b686df8..2aa91cc 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -181,6 +181,33 @@ (cadr (elmo-get-hash-val (format "#%d" number) (elmo-msgdb-get-mark-hashtb msgdb)))) +(defsubst elmo-msgdb-set-mark (msgdb number mark) + "Set MARK of the message with NUMBER in the MSGDB. +if MARK is nil, mark is removed." + (let ((elem (elmo-get-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb)))) + (if elem + (if mark + ;; Set mark of the elem + (setcar (cdr elem) mark) + ;; Delete elem from mark-alist + (elmo-msgdb-set-mark-alist + msgdb + (delq elem (elmo-msgdb-get-mark-alist msgdb))) + (elmo-clear-hash-val (format "#%d" number) + (elmo-msgdb-get-mark-hashtb msgdb))) + (when mark + ;; Append new element. + (elmo-msgdb-set-mark-alist + msgdb + (nconc + (elmo-msgdb-get-mark-alist msgdb) + (list (setq elem (list number mark))))) + (elmo-set-hash-val (format "#%d" number) elem + (elmo-msgdb-get-mark-hashtb msgdb)))) + ;; 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) @@ -498,10 +525,10 @@ content of MSGDB is changed." (defun elmo-flag-table-save (dir flag-table) (elmo-object-save - (expand-file-name (expand-file-name elmo-flag-table-filename dir) - (mapatoms (lambda (atom) - (cons (symbol-name atom) (symbol-value atom))) - flag-table)))) + (expand-file-name elmo-flag-table-filename dir) + (mapatoms (lambda (atom) + (cons (symbol-name atom) (symbol-value atom))) + flag-table))) ;;; ;; persistent mark handling ;; (for each folder) @@ -813,7 +840,7 @@ Return CONDITION itself if no entity exists in msgdb." (setcar (cdddr msgdb) index)) (defsubst elmo-msgdb-set-path (msgdb path) - (setcar (cddddr msgdb) index)) + (setcar (cddddr msgdb) path)) (defsubst elmo-msgdb-overview-entity-get-references (entity) (and entity (aref (cdr entity) 1))) -- 1.7.10.4