Synch up with main trunk, and prepare the release 2.12.0.
[elisp/wanderlust.git] / wl / wl-thread.el
index ce3ad81..ad69175 100644 (file)
@@ -515,7 +515,7 @@ ENTITY is returned."
     (let ((entity (wl-thread-get-entity msg))
          top-child top-entity update-msgs invisible-top)
       (setq wl-summary-buffer-number-list
-           (delq msg wl-summary-buffer-number-list))         
+           (delq msg wl-summary-buffer-number-list))
       (when entity
        (let ((parent (wl-thread-entity-get-parent-entity entity)))
          (if parent
@@ -716,18 +716,19 @@ Message is inserted to the summary buffer."
         (i 0)
         beg)
     (while top-list
-      (when (or (zerop (% i 5)) (= i num))
-       (elmo-display-progress
-        'wl-thread-update-indent-string-thread
-        "Updating thread indent..."
-        (/ (* i 100) num)))
+      (when (> num elmo-display-progress-threshold)
+       (setq i (1+ i))
+       (when (or (zerop (% i 5)) (= i num))
+         (elmo-display-progress
+          'wl-thread-update-indent-string-thread
+          "Updating thread indent..."
+          (/ (* i 100) num))))
       (when (car top-list)
        (wl-summary-jump-to-msg (car top-list))
        (setq beg (point))
        (wl-thread-goto-bottom-of-sub-thread)
        (wl-thread-update-indent-string-region beg (point)))
-      (setq top-list (cdr top-list)
-           i (1+ i)))
+      (setq top-list (cdr top-list)))
     (message "Updating thread indent...done")))
 
 (defun wl-thread-update-children-number (entity)
@@ -1072,7 +1073,7 @@ Message is inserted to the summary buffer."
       (incf depth)
       (setq entity (wl-thread-get-entity number)))
     depth))
-  
+
 (defun wl-thread-update-indent-string-region (beg end)
   (interactive "r")
   (save-excursion
@@ -1143,7 +1144,15 @@ Message is inserted to the summary buffer."
            (wl-thread-entity-set-children
             dst-parent-entity
             (append children (list number)))
-           (wl-thread-entity-set-linked entity t))
+           (wl-thread-entity-set-linked
+            entity
+            (let ((parent (elmo-message-entity-parent
+                           wl-summary-buffer-elmo-folder
+                           (elmo-message-entity
+                            wl-summary-buffer-elmo-folder
+                            number))))
+              (or (null parent)
+                  (/= parent-number (elmo-message-entity-number parent))))))
        ;; insert as top
        (wl-append wl-thread-entity-list (list number))
        (wl-thread-entity-set-linked entity nil))