From: teranisi Date: Tue, 26 Dec 2000 01:02:42 +0000 (+0000) Subject: * wl-thread.el (wl-thread-open-all): Rewrite to open all threads and X-Git-Tag: wl-2_4_1pre~29 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6c0f9e89373ecf29eaba0a0c3a7121c29ff4459;p=elisp%2Fwanderlust.git * wl-thread.el (wl-thread-open-all): Rewrite to open all threads and keep cursor position. (Advised by OKAZAKI Tetsurou ) (wl-thread-close-all): keep cursor position. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index fce8071..52f8bdf 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,9 @@ +2000-12-26 Yuuichi Teranishi + + * wl-thread.el (wl-thread-open-all): Rewrite to open all threads and + keep cursor position. (Advised by OKAZAKI Tetsurou ) + (wl-thread-close-all): keep cursor position. + 2000-12-24 TAKAHASHI Kaoru * wl-version.el (wl-version-status-alist): Use `zerop' instead of diff --git a/wl/wl-thread.el b/wl/wl-thread.el index e028615..e153785 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -550,47 +550,51 @@ The closed parent will be opened." "Close all top threads." (interactive) (message "Closing all threads...") - (let ((entities wl-thread-entity-list) - (cur 0) - (len (length wl-thread-entity-list))) - (while entities - (when (and (wl-thread-entity-get-opened (wl-thread-get-entity - (car entities))) - (wl-thread-entity-get-children (wl-thread-get-entity - (car entities)))) - (wl-summary-jump-to-msg (car entities)) - (wl-thread-open-close)) - (when (> len elmo-display-progress-threshold) - (setq cur (1+ cur)) - (if (or (zerop (% cur 5)) (= cur len)) - (elmo-display-progress - 'wl-thread-close-all "Closing all threads..." - (/ (* cur 100) len)))) - (setq entities (cdr entities)))) - (message "Closing all threads...done") - (goto-char (point-max))) + (save-excursion + (let ((entities wl-thread-entity-list) + (cur 0) + (len (length wl-thread-entity-list))) + (while entities + (when (and (wl-thread-entity-get-opened (wl-thread-get-entity + (car entities))) + (wl-thread-entity-get-children (wl-thread-get-entity + (car entities)))) + (wl-summary-jump-to-msg (car entities)) + (wl-thread-open-close)) + (when (> len elmo-display-progress-threshold) + (setq cur (1+ cur)) + (if (or (zerop (% cur 5)) (= cur len)) + (elmo-display-progress + 'wl-thread-close-all "Closing all threads..." + (/ (* cur 100) len)))) + (setq entities (cdr entities))))) + (message "Closing all threads...done")) (defun wl-thread-open-all () "Open all threads." (interactive) (message "Opening all threads...") - (let ((entities wl-thread-entity-list) - (cur 0) - (len (length wl-thread-entity-list))) - (while entities - (if (not (wl-thread-entity-get-opened (wl-thread-get-entity - (car entities)))) - (wl-thread-entity-force-open (wl-thread-get-entity - (car entities)))) - (when (> len elmo-display-progress-threshold) - (setq cur (1+ cur)) - (if (or (zerop (% cur 5)) (= cur len)) - (elmo-display-progress - 'wl-thread-open-all "Opening all threads..." - (/ (* cur 100) len)))) - (setq entities (cdr entities)))) - (message "Opening all threads...done") - (goto-char (point-max))) + (save-excursion + (goto-char (point-min)) + (let ((len (count-lines (point-min) (point-max))) + (cur 0) + entity) + (while (not (eobp)) + (unless (wl-thread-entity-get-opened + (setq entity (wl-thread-get-entity + (wl-summary-message-number)))) + (wl-thread-entity-force-open entity)) + (wl-thread-goto-bottom-of-sub-thread) + (when (> len elmo-display-progress-threshold) + (setq cur (1+ cur)) + (elmo-display-progress + 'wl-thread-open-all "Opening all threads..." + (/ (* cur 100) len))))) + ;; Make sure to be 100%. + (elmo-display-progress + 'wl-thread-open-all "Opening all threads..." + 100)) + (message "Opening all threads...done")) (defun wl-thread-open-all-unread () (interactive)