* wl-e21.el (wl-draft-insert-signature): Fix comment style.
[elisp/wanderlust.git] / wl / wl-thread.el
index c959030..7818c1d 100644 (file)
                                      (nth (- (length curc) 1)
                                           curc))))
                        (wl-thread-entity-get-number curp)))
-    (setcar (cddr to) (wl-append children
-                                (list (car entity))))
+    (wl-thread-entity-set-children to (wl-append children (list (car entity))))
     (setq wl-thread-entities (cons entity wl-thread-entities))
     (elmo-set-hash-val (format "#%d" (car entity)) entity
                       wl-thread-entity-hashtb)))
@@ -296,7 +295,7 @@ ENTITY is returned."
   "Jump to the message with specified number in the current summary."
   (interactive)
   (let ((num (or number
-                (string-to-int
+                (string-to-number
                  (read-from-minibuffer "Jump to Message(No.): ")))))
     (wl-thread-entity-force-open (wl-thread-get-entity num))
     (wl-summary-jump-to-msg num)))
@@ -489,9 +488,8 @@ ENTITY is returned."
                        (apply (function nconc)
                               update-msgs
                               (mapcar
-                               (function
-                                (lambda (message)
-                                  (wl-thread-get-children-msgs message t)))
+                               (lambda (message)
+                                 (wl-thread-get-children-msgs message t))
                                children))))
                (wl-thread-entity-set-children
                 parent (append older-brothers children younger-brothers))
@@ -597,8 +595,8 @@ Message is inserted to the summary buffer."
   (let ((parent (wl-thread-get-entity parent-msg))
        child-entity invisible-top)
 ;;; Update the thread view...not implemented yet.
-;;;  (when force-insert
-;;;    (if parent
+;;;    (when force-insert
+;;;      (if parent
 ;;;      (wl-thread-entity-force-open parent))
     (when (and wl-summary-max-thread-depth parent)
       (let ((cur parent)
@@ -613,8 +611,9 @@ Message is inserted to the summary buffer."
        ;; insert as children.
        (wl-thread-entity-insert-as-children
         parent
-        (setq child-entity (wl-thread-create-entity
-                            msg (nth 0 parent) nil linked)))
+        (setq child-entity
+              (wl-thread-create-entity
+               msg (wl-thread-entity-get-number parent) nil linked)))
       ;; insert as top message.
       (wl-thread-entity-insert-as-top
        (wl-thread-create-entity msg nil)))
@@ -630,8 +629,8 @@ Message is inserted to the summary buffer."
                                    parent-msg))
              (when parent
                ;; use thread structure.
-               ;;(wl-thread-entity-get-nearly-older-brother
-               ;; child-entity parent))) ; return value
+;;;            (wl-thread-entity-get-nearly-older-brother
+;;;             child-entity parent))) ; return value
                (wl-thread-entity-get-number parent))) ; return value
 ;;;          (setq beg (point))
 ;;;          (wl-thread-goto-bottom-of-sub-thread)
@@ -640,19 +639,19 @@ Message is inserted to the summary buffer."
          (wl-thread-update-children-number invisible-top)
          nil))))
 
-;(defun wl-thread-get-parent-list (msgs)
-;  ;; return ancestors
-;  (let* ((msgs2 msgs)
-;       myself)
-;    (while msgs2
-;      (setq myself (car msgs2)
-;          msgs2 (cdr msgs2))
-;      (while (not (eq myself (car msgs2)))
-;      (if (wl-thread-descendant-p myself (car msgs2))
-;          (setq msgs (delq (car msgs2) msgs)))
-;      (setq msgs2 (or (cdr msgs2) msgs)))
-;      (setq msgs2 (cdr msgs2)))
-;    msgs))
+;;;(defun wl-thread-get-parent-list (msgs)
+;;;  ;; return ancestors
+;;;  (let* ((msgs2 msgs)
+;;;     myself)
+;;;    (while msgs2
+;;;      (setq myself (car msgs2)
+;;;        msgs2 (cdr msgs2))
+;;;      (while (not (eq myself (car msgs2)))
+;;;    (if (wl-thread-descendant-p myself (car msgs2))
+;;;        (setq msgs (delq (car msgs2) msgs)))
+;;;    (setq msgs2 (or (cdr msgs2) msgs)))
+;;;      (setq msgs2 (cdr msgs2)))
+;;;    msgs))
 
 (defun wl-thread-get-parent-list (msgs)
   ;; return connected ancestors
@@ -786,14 +785,14 @@ Message is inserted to the summary buffer."
        (setq temp-mark (wl-summary-get-score-mark msg-num)))
       (setq message-entity
            (elmo-message-entity wl-summary-buffer-elmo-folder
-                                (nth 0 entity)))
-;;;   (wl-delete-all-overlays)
+                                msg-num))
+;;;      (wl-delete-all-overlays)
       (when message-entity
        (wl-summary-insert-line
         (wl-summary-create-line
          message-entity
          (elmo-message-entity wl-summary-buffer-elmo-folder
-                              (nth 0 parent-entity))
+                              (wl-thread-entity-get-number parent-entity))
          temp-mark
          (elmo-message-status wl-summary-buffer-elmo-folder msg-num)
          (if wl-thread-insert-force-opened
@@ -809,7 +808,7 @@ Message is inserted to the summary buffer."
     (while msgs
       (wl-thread-insert-entity-sub indent entity parent-entity all)
       (setq msgs (cdr msgs))
-      (setq children (nth 2 entity))
+      (setq children (wl-thread-entity-get-children entity))
       (if children
          ;; insert children
          (when (or wl-thread-insert-force-opened
@@ -841,15 +840,15 @@ Message is inserted to the summary buffer."
            (throw 'done t)))
       nil)))
 
-;; (defun wl-thread-goto-bottom-of-sub-thread ()
-;;   (interactive)
-;;   (let ((depth (wl-thread-get-depth-of-current-line)))
-;;     (forward-line 1)
-;;     (while (and (not (eobp))
-;;             (> (wl-thread-get-depth-of-current-line)
-;;                depth))
-;;       (forward-line 1))
-;;     (beginning-of-line)))
+;;;(defun wl-thread-goto-bottom-of-sub-thread ()
+;;;  (interactive)
+;;;  (let ((depth (wl-thread-get-depth-of-current-line)))
+;;;    (forward-line 1)
+;;;    (while (and (not (eobp))
+;;;            (> (wl-thread-get-depth-of-current-line)
+;;;               depth))
+;;;      (forward-line 1))
+;;;    (beginning-of-line)))
 
 (defun wl-thread-goto-bottom-of-sub-thread (&optional msg)
   (interactive)
@@ -944,8 +943,7 @@ Message is inserted to the summary buffer."
   (let (depth beg)
     (wl-thread-entity-set-opened entity nil)
     (setq depth (wl-thread-get-depth-of-current-line))
-    (beginning-of-line)
-    (setq beg (point))
+    (setq beg (point-at-bol))
     (wl-thread-goto-bottom-of-sub-thread)
     (wl-thread-remove-argument-region beg
                                      (point))
@@ -954,7 +952,7 @@ Message is inserted to the summary buffer."
     (wl-thread-insert-entity (- depth 1)
                             entity
                             (wl-thread-get-entity
-                             (nth 3 entity))
+                             (wl-thread-entity-get-parent entity))
                             nil)
     (delete-char 1) ; delete '\n'
     (wl-thread-print-argument-region beg (point))))
@@ -971,16 +969,15 @@ Message is inserted to the summary buffer."
 
 (defun wl-thread-open (entity)
   (let (depth beg)
-    (beginning-of-line)
-    (setq beg (point))
+    (setq beg (point-at-bol))
     (setq depth (wl-thread-get-depth-of-current-line))
-    (end-of-line)
-    (delete-region beg (point))
+    (delete-region (point-at-bol) (point-at-eol))
     (wl-thread-entity-set-opened entity t)
     (wl-thread-insert-entity depth ;(- depth 1)
                             entity
                             (wl-thread-get-entity
-                             (nth 3 entity)) nil)
+                             (wl-thread-entity-get-parent entity))
+                            nil)
     (delete-char 1) ; delete '\n'
     (wl-thread-print-argument-region beg (point))))
 
@@ -997,7 +994,7 @@ Message is inserted to the summary buffer."
 (defun wl-thread-open-close (&optional force-open)
   (interactive "P")
   (when (eq wl-summary-buffer-view 'thread)
-;;; (if (equal wl-thread-top-entity '(nil t nil nil))
+;;;    (if (equal wl-thread-top-entity '(nil t nil nil))
 ;;;    (error "There's no thread structure"))
     (save-excursion
       (let ((inhibit-read-only t)
@@ -1091,7 +1088,7 @@ Message is inserted to the summary buffer."
     (if (string= dst-parent "")
        (setq dst-parent nil)
       (if (interactive-p)
-         (setq dst-parent (string-to-int dst-parent))
+         (setq dst-parent (string-to-number dst-parent))
        (setq dst-parent parent-number)))
     (if (and dst-parent
             (memq dst-parent (wl-thread-get-children-msgs number)))