* wl-thread.el (wl-thread-open-all): Rewrite to open all threads and
authorteranisi <teranisi>
Tue, 26 Dec 2000 01:02:42 +0000 (01:02 +0000)
committerteranisi <teranisi>
Tue, 26 Dec 2000 01:02:42 +0000 (01:02 +0000)
keep cursor position. (Advised by OKAZAKI Tetsurou  <okazaki@be.to>)
(wl-thread-close-all): keep cursor position.

wl/ChangeLog
wl/wl-thread.el

index fce8071..52f8bdf 100644 (file)
@@ -1,3 +1,9 @@
+2000-12-26  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-thread.el (wl-thread-open-all): Rewrite to open all threads and
+       keep cursor position. (Advised by OKAZAKI Tetsurou  <okazaki@be.to>)
+       (wl-thread-close-all): keep cursor position.
+
 2000-12-24  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * wl-version.el (wl-version-status-alist): Use `zerop' instead of
index e028615..e153785 100644 (file)
@@ -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)