From: hmurata Date: Fri, 21 Jul 2006 13:56:55 +0000 (+0000) Subject: * wl-folder.el (wl-folder-sync-entity): Rewrite without X-Git-Tag: wl-2_15_4~21 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdd258ad5f142147f290dce3ccfd20e714d71c35;p=elisp%2Fwanderlust.git * wl-folder.el (wl-folder-sync-entity): Rewrite without `wl-summary-goto-folder-subr'. (wl-folder-mark-as-read-all-entity): Likewise. * wl-summary.el (wl-summary-sync): Accept symbol for `range. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 3349c74..9d264b7 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,11 @@ +2006-07-21 Hiroya Murata + + * wl-folder.el (wl-folder-sync-entity): Rewrite without + `wl-summary-goto-folder-subr'. + (wl-folder-mark-as-read-all-entity): Likewise. + + * wl-summary.el (wl-summary-sync): Accept symbol for `range. + 2006-06-22 Yoichi NAKAYAMA * wl-thread.el (wl-thread-force-open): Arranged. diff --git a/wl/wl-folder.el b/wl/wl-folder.el index a2f90f6..91d52ab 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -1043,36 +1043,32 @@ If current line is group folder, check all sub entries." ((stringp entity) (let* ((folder (wl-folder-get-elmo-folder entity)) (nums (wl-folder-get-entity-info entity)) - (wl-summary-highlight (if (or (wl-summary-sticky-p folder) - (wl-summary-always-sticky-folder-p - folder)) - wl-summary-highlight)) - wl-auto-select-first new unread sticky) - (setq new (or (car nums) 0)) - (setq unread (or (cadr nums) 0)) - (if (or (not unread-only) - (or (< 0 new) (< 0 unread))) - (let ((wl-summary-buffer-name - (if (setq sticky (get-buffer (wl-summary-sticky-buffer-name - (elmo-folder-name-internal - folder)))) - ;; Sticky folder exists. - (wl-summary-sticky-buffer-name - (elmo-folder-name-internal folder)) - (concat - wl-summary-buffer-name - (symbol-name this-command)))) - (wl-summary-use-frame nil) - (wl-summary-always-sticky-folder-list nil)) - (save-window-excursion - (save-excursion - (wl-summary-goto-folder-subr entity - (wl-summary-get-sync-range - folder) - nil nil nil t) - (if sticky - (wl-summary-save-status) - (wl-summary-exit)))))))))) + (new (or (car nums) 0)) + (unread (or (cadr nums) 0))) + (when (or (not unread-only) + (or (> new 0) (> unread 0))) + (let ((summary (wl-summary-get-buffer entity)) + (range (wl-summary-get-sync-range folder))) + (if summary + (save-selected-window + (with-current-buffer summary + (let ((win (get-buffer-window summary t))) + (when win + (select-window win))) + (wl-summary-sync 'unset-cursor range) + (wl-summary-save-status))) + (elmo-folder-open folder 'load-msgdb) + (unwind-protect + (progn + (elmo-folder-synchronize folder nil (eq range 'all)) + (wl-folder-set-folder-updated + entity + (list + 0 + (or (cdr (assq 'unread (elmo-folder-count-flags folder))) + 0) + (elmo-folder-length folder)))) + (elmo-folder-close folder))))))))) (defun wl-folder-sync-current-entity (&optional unread-only) "Synchronize the folder at position. @@ -1100,39 +1096,34 @@ If current line is group folder, check all subfolders." (wl-folder-mark-as-read-all-entity (car flist)) (setq flist (cdr flist))))) ((stringp entity) - (let* ((nums (wl-folder-get-entity-info entity)) - (folder (wl-folder-get-elmo-folder entity)) - (wl-summary-highlight (if (or (wl-summary-sticky-p folder) - (wl-summary-always-sticky-folder-p - folder)) - wl-summary-highlight)) - wl-auto-select-first new unread sticky) - (setq new (or (car nums) 0)) - (setq unread (or (cadr nums) 0)) - (if (or (< 0 new) (< 0 unread)) - (save-window-excursion - (save-excursion - (let ((wl-summary-buffer-name - (if (setq sticky (get-buffer - (wl-summary-sticky-buffer-name - (elmo-folder-name-internal - folder)))) - ;; Sticky folder exists. - (wl-summary-sticky-buffer-name - (elmo-folder-name-internal folder)) - (concat - wl-summary-buffer-name - (symbol-name this-command)))) - (wl-summary-use-frame nil) - (wl-summary-always-sticky-folder-list nil)) - (wl-summary-goto-folder-subr entity - (wl-summary-get-sync-range folder) - nil) - (wl-summary-mark-as-read-all) - (if sticky - (wl-summary-save-status) - (wl-summary-exit))))) - (sit-for 0)))))) + (let* ((folder (wl-folder-get-elmo-folder entity)) + (nums (wl-folder-get-entity-info entity)) + (new (or (car nums) 0)) + (unread (or (cadr nums) 0))) + (when (or (> new 0) (> unread 0)) + (let ((summary (wl-summary-get-buffer entity)) + (range (wl-summary-get-sync-range folder))) + (if summary + (save-selected-window + (with-current-buffer summary + (let ((win (get-buffer-window summary t))) + (when win + (select-window win))) + (wl-summary-sync 'unset-cursor range) + (wl-summary-mark-as-read-all) + (wl-summary-save-status))) + (elmo-folder-open folder 'load-msgdb) + (unwind-protect + (progn + (elmo-folder-synchronize folder nil (eq range 'all)) + (elmo-folder-unset-flag + folder + (elmo-folder-list-flagged folder 'unread 'in-msgdb) + 'unread) + (wl-folder-set-folder-updated + entity + (list 0 0 (elmo-folder-length folder)))) + (elmo-folder-close folder))))))))) (defun wl-folder-mark-as-read-all-current-entity () "Mark as read all messages in the folder at position. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 0138c24..9624b09 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1390,6 +1390,8 @@ This function is defined by `wl-summary-define-sort-command'." sort-by) (msgdb-dir (elmo-folder-msgdb-path folder)) (range (or force-range (wl-summary-input-range (elmo-folder-name-internal folder))))) + (when (symbolp range) + (setq range (symbol-name range))) (cond ((string-match "rescan" range) (let ((msg (wl-summary-message-number)) (wl-use-scoring (if (string-match "noscore" range)