From: hmurata Date: Sat, 5 Mar 2005 03:28:42 +0000 (+0000) Subject: * wl-summary.el (wl-summary-buffer-attach): Connect to signal X-Git-Tag: wl-2_14-root~10 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6444631eeac4bef1933e27202080f62ac536aada;p=elisp%2Fwanderlust.git * wl-summary.el (wl-summary-buffer-attach): Connect to signal `update-overview' (wl-summary-buffer-detach): Disconnect from it. (wl-summary-rescan-message): Use command. * wl-message.el (wl-message-buffer-display): Use `with-current-buffer' instead of `save-excursion'. * modb.el (elmo-msgdb-update-entity): New API and define generic implement. * modb-standard.el (elmo-msgdb-update-entity): Define. * modb-entity.el (elmo-msgdb-message-entity-update-fields): New API and define generic implement. * elmo.el (update-overview): New singnal. * elmo-shimbun.el (elmo-shimbun-update-overview): Rewrite use `elmo-msgdb-update-entity' and emit signal `update-overview'. (elmo-message-entity-parent): Define. * elmo-pipe.el (elmo-pipe-connect-signals): Connect to signal `update-overview'. * elmo-multi.el (elmo-multi-connect-signals): Ditto. * elmo-filter.el (elmo-filter-connect-signals): Ditto. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 40cf7ac..ba4d96a 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,26 @@ +2005-03-05 Hiroya Murata + + * modb.el (elmo-msgdb-update-entity): New API and define generic + implement. + + * modb-standard.el (elmo-msgdb-update-entity): Define. + + * modb-entity.el (elmo-msgdb-message-entity-update-fields): New + API and define generic implement. + + * elmo.el (update-overview): New singnal. + + * elmo-shimbun.el (elmo-shimbun-update-overview): Rewrite use + `elmo-msgdb-update-entity' and emit signal `update-overview'. + (elmo-message-entity-parent): Define. + + * elmo-pipe.el (elmo-pipe-connect-signals): Connect to signal + `update-overview'. + + * elmo-multi.el (elmo-multi-connect-signals): Ditto. + + * elmo-filter.el (elmo-filter-connect-signals): Ditto. + 2005-02-27 Yuuichi Teranishi * elmo.el (elmo-folder-synchronize): Sort the return value of @@ -5,7 +28,6 @@ * elmo-util.el (elmo-list-diff): Don't care the order of the returned list. - 2005-02-27 Hiroya Murata diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index fda3160..b73c5a3 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -84,6 +84,12 @@ (elmo-define-signal-handler (folder target number) (elmo-emit-signal 'cache-changed folder number)) (elmo-define-signal-filter (folder target number) + (memq number (elmo-folder-list-messages folder nil t)))) + (elmo-connect-signal + target 'update-overview folder + (elmo-define-signal-handler (folder target number) + (elmo-emit-signal 'update-overview folder number)) + (elmo-define-signal-filter (folder target number) (memq number (elmo-folder-list-messages folder nil t))))) (defun elmo-filter-number-list-load (dir) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index bfa4259..b8926c9 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -94,6 +94,14 @@ 'flag-changed folder (car (elmo-multi-map-numbers folder child (list number))))) (elmo-define-signal-filter (folder sender) + (memq sender (elmo-multi-folder-children-internal folder)))) + (elmo-connect-signal + nil 'update-overview folder + (elmo-define-signal-handler (folder child number) + (elmo-emit-signal + 'update-overview folder + (car (elmo-multi-map-numbers folder child (list number))))) + (elmo-define-signal-filter (folder sender) (memq sender (elmo-multi-folder-children-internal folder))))) (defun elmo-multi-map-numbers (folder child numbers) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index 1a499e3..07a12e4 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -68,7 +68,11 @@ (elmo-connect-signal destination 'cache-changed folder (elmo-define-signal-handler (folder dst number) - (elmo-emit-signal 'cache-changed folder number)))) + (elmo-emit-signal 'cache-changed folder number))) + (elmo-connect-signal + destination 'update-overview folder + (elmo-define-signal-handler (folder dst number) + (elmo-emit-signal 'update-overview folder number)))) (luna-define-method elmo-folder-get-primitive-list ((folder elmo-pipe-folder)) (nconc diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index bb5bc88..12660af 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -377,43 +377,34 @@ If it is the symbol `all', update overview for all shimbun folders." (let ((entity (elmo-message-entity folder shimbun-id)) (message-id (shimbun-header-id header)) references) - (unless (string= shimbun-id message-id) - (elmo-message-entity-set-field - entity 'x-original-id message-id) - (elmo-shimbun-header-set-extra-field - header "x-shimbun-id" shimbun-id) - (elmo-set-hash-val message-id - entity - (elmo-shimbun-folder-entity-hash folder)) - (elmo-set-hash-val shimbun-id - entity - (elmo-shimbun-folder-entity-hash folder))) - (elmo-message-entity-set-field - entity - 'from - (elmo-mime-string (shimbun-header-from header))) - (elmo-message-entity-set-field - entity - 'subject - (elmo-mime-string (shimbun-header-subject header))) - (elmo-message-entity-set-field - entity - 'date - (shimbun-header-date header)) - (when (setq references - (or (elmo-msgdb-get-last-message-id - (elmo-field-body "in-reply-to")) - (elmo-msgdb-get-last-message-id - (elmo-field-body "references")))) - (elmo-message-entity-set-field - entity - 'references - (or (elmo-message-entity-field - (elmo-get-hash-val - references - (elmo-shimbun-folder-entity-hash folder)) - 'message-id) - references))))) + (when (elmo-msgdb-update-entity + (elmo-folder-msgdb folder) + entity + (nconc + (unless (string= shimbun-id message-id) + (elmo-shimbun-header-set-extra-field + header "x-shimbun-id" shimbun-id) + (elmo-set-hash-val message-id + entity + (elmo-shimbun-folder-entity-hash folder)) + (elmo-set-hash-val shimbun-id + entity + (elmo-shimbun-folder-entity-hash folder)) + (list (cons 'x-original-id message-id))) + (list + (cons 'from + (elmo-mime-string (shimbun-header-from header))) + (cons 'subject + (elmo-mime-string (shimbun-header-subject header))) + (cons 'date + (shimbun-header-date header)) + (cons 'references + (or (elmo-msgdb-get-last-message-id + (elmo-field-body "in-reply-to")) + (elmo-msgdb-get-last-message-id + (elmo-field-body "references"))))))) + (elmo-emit-signal 'update-overview folder + (elmo-message-entity-number entity))))) (luna-define-method elmo-map-message-fetch ((folder elmo-shimbun-folder) location strategy @@ -526,6 +517,13 @@ If it is the symbol `all', update overview for all shimbun folders." (elmo-folder-kill-messages folder numbers) t) +(luna-define-method elmo-message-entity-parent ((folder elmo-shimbun-folder) + entity) + (let ((references (elmo-message-entity-field entity 'references))) + (and references + (elmo-get-hash-val references + (elmo-shimbun-folder-entity-hash folder))))) + (require 'product) (product-provide (provide 'elmo-shimbun) (require 'elmo-version)) diff --git a/elmo/elmo.el b/elmo/elmo.el index fdad8da..bc273b7 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -98,6 +98,9 @@ Otherwise, entire fetching of the message is aborted without confirmation." (elmo-define-signal cache-changed (number) "Notify the change cache status of the message with NUMBER.") +(elmo-define-signal update-overview (number) + "Notify update overview of the message with NUMBER.") + ;; autoloads (eval-and-compile (autoload 'md5 "md5") diff --git a/elmo/modb-entity.el b/elmo/modb-entity.el index 4b9c4da..c39c733 100644 --- a/elmo/modb-entity.el +++ b/elmo/modb-entity.el @@ -89,6 +89,13 @@ ENTITY is the message entity structure. FIELD is a symbol of the field. VALUE is the field value to set.") +(luna-define-generic elmo-msgdb-message-entity-update-fields (handler + entity values) + "Update message entity by VALUES. +HANDLER is the message entity handler. +ENTITY is the message entity structure. +VALUES is an alist of field-name and field-value.") + (luna-define-generic elmo-msgdb-copy-message-entity (handler entity) "Copy message entity. HANDLER is the message entity handler. @@ -162,6 +169,18 @@ Header region is supposed to be narrowed.") entity) (plist-get (cdr entity) :number)) +(luna-define-method elmo-msgdb-message-entity-update-fields + ((handler modb-entity-handler) entity values) + (let (updated) + (dolist (pair values) + (unless (equal + (cdr pair) + (elmo-msgdb-message-entity-field handler entity (car pair))) + (elmo-msgdb-message-entity-set-field handler entity + (car pair) (cdr pair)) + (setq updated t))) + updated)) + ;; Legacy implementation. (eval-and-compile (luna-define-class modb-legacy-entity-handler (modb-entity-handler))) diff --git a/elmo/modb-standard.el b/elmo/modb-standard.el index 7abb55a..46e4b61 100644 --- a/elmo/modb-standard.el +++ b/elmo/modb-standard.el @@ -476,6 +476,15 @@ When non-nil, redundunt message-id string are not saved." (modb-standard-set-flag-modified msgdb number)) duplicate)))) +(luna-define-method elmo-msgdb-update-entity ((msgdb modb-standard) + entity values) + (let ((handler (elmo-message-entity-handler entity))) + (when (elmo-msgdb-message-entity-update-fields handler entity values) + (modb-standard-set-message-modified + msgdb + (elmo-msgdb-message-entity-number handler entity)) + t))) + (luna-define-method elmo-msgdb-delete-messages ((msgdb modb-standard) numbers) (let ((number-list (modb-standard-number-list-internal msgdb)) diff --git a/elmo/modb.el b/elmo/modb.el index aa42d4c..891ffed 100644 --- a/elmo/modb.el +++ b/elmo/modb.el @@ -134,6 +134,10 @@ Return CONDITION itself if no entity exists in msgdb.") "Append a ENTITY with FLAGS into the MSGDB. Return non-nil if message-id of entity is duplicated.") +(luna-define-generic elmo-msgdb-update-entity (msgdb entity values) + "Update a ENTITY with VALUES into the MSGDB. +VALUES is an alist of field-name and field-value.") + (luna-define-generic elmo-msgdb-delete-messages (msgdb numbers) "Delete messages which are contained NUMBERS from MSGDB. Return non-nil if messages is deleted successfully.") @@ -220,6 +224,14 @@ FIELD is a symbol of the field.") (or numbers (elmo-msgdb-list-messages msgdb))) condition))) +(luna-define-method elmo-msgdb-update-entity ((msgdb modb-generic) + entity values) + (when (elmo-msgdb-message-entity-update-fields + (elmo-message-entity-handler entity) + entity values) + (modb-generic-set-message-modified-internal msgdb t) + t)) + (luna-define-method elmo-msgdb-message-entity-handler ((msgdb modb-generic)) (or modb-entity-default-cache-internal (setq modb-entity-default-cache-internal diff --git a/wl/ChangeLog b/wl/ChangeLog index d2095ad..c00cc2a 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,13 @@ +2005-03-05 Hiroya Murata + + * wl-summary.el (wl-summary-buffer-attach): Connect to signal + `update-overview' + (wl-summary-buffer-detach): Disconnect from it. + (wl-summary-rescan-message): Use command. + + * wl-message.el (wl-message-buffer-display): Use + `with-current-buffer' instead of `save-excursion'. + 2005-03-04 Hiroya Murata * wl-mime.el (wl-draft-preview-attributes-list): Protect diff --git a/wl/wl-message.el b/wl/wl-message.el index 5c7f485..1611a37 100644 --- a/wl/wl-message.el +++ b/wl/wl-message.el @@ -557,8 +557,7 @@ Returns non-nil if bottom of message." (setq redisplay t)) (when (or force-reload redisplay) (condition-case err - (save-excursion - (set-buffer hit) + (with-current-buffer hit (when (or force-reload (null entity) (not (elmo-mime-entity-display-p diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 8e23cce..f719f8a 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -690,13 +690,21 @@ See also variable `wl-use-petname'." 'cache-changed (current-buffer) (elmo-define-signal-handler (buffer folder number) - (wl-summary-update-persistent-mark-on-event buffer (list number)))))) + (wl-summary-update-persistent-mark-on-event buffer (list number)))) + (elmo-connect-signal + wl-summary-buffer-elmo-folder + 'update-overview + (current-buffer) + (elmo-define-signal-handler (buffer folder number) + (with-current-buffer buffer + (wl-summary-rescan-message number)))))) (defun wl-summary-buffer-detach () (when (and (eq major-mode 'wl-summary-mode) wl-summary-buffer-elmo-folder) (elmo-disconnect-signal 'flag-changed (current-buffer)) - (elmo-disconnect-signal 'cache-changed (current-buffer)))) + (elmo-disconnect-signal 'cache-changed (current-buffer)) + (elmo-disconnect-signal 'update-overview (current-buffer)))) (defun wl-status-update () (interactive) @@ -1144,6 +1152,49 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (forward-line -1) (set-buffer-modified-p nil))) +(defun wl-summary-rescan-message (number &optional reparent) + "Rescan current message without updating." + (interactive (list (wl-summary-message-number))) + (let ((start-number (wl-summary-message-number)) + (start-column (current-column))) + (when (wl-summary-jump-to-msg number) + (let* ((folder wl-summary-buffer-elmo-folder) + (entity (elmo-message-entity folder number)) + (inhibit-read-only t)) + (if (eq wl-summary-buffer-view 'thread) + (let* ((thread-entity (wl-thread-get-entity number)) + (descendant (wl-thread-entity-get-descendant thread-entity)) + (thread-parent (wl-thread-entity-get-parent thread-entity)) + (entity-parent (elmo-message-entity-number + (elmo-message-entity-parent folder entity))) + update-top-list) + (if (and (not reparent) + (eq thread-parent entity-parent)) + (progn + (wl-thread-entity-set-linked thread-entity nil) + (wl-thread-update-line-on-buffer-sub nil number)) + (wl-thread-delete-message number 'deep 'update) + (dolist (number (cons number descendant)) + (setq update-top-list + (nconc + update-top-list + (wl-summary-insert-thread + (elmo-message-entity folder number) + folder + 'update)))) + (when update-top-list + (wl-thread-update-indent-string-thread + (elmo-uniq-list update-top-list))))) + (delete-region (point-at-bol) (1+ (point-at-eol))) + (wl-summary-insert-line + (wl-summary-create-line entity nil + (wl-summary-temp-mark number) + (elmo-message-flags folder number) + (elmo-message-cached-p folder number))))) + (wl-summary-set-message-modified) + (wl-summary-jump-to-msg start-number) + (move-to-column start-column)))) + (defun wl-summary-next-folder-or-exit (&optional next-entity upward) (if (and next-entity wl-auto-select-next)