[Mew-dist 15155] RE: b82
KOIE Hidetaka ( 鯉江英隆 )
hide at example.com
2000年 11月 28日 (火) 03:59:48 JST
From: Kazu Yamamoto (山本和彦) <kazu at example.com>
Subject: [Mew-dist 15147] b82
Date: Mon, 27 Nov 2000 22:16:39 +0900
Message-Id: <20001127.222343.74719930.kazu at example.com>
| b82 を出します。(もうちょっとパッチをマージしたかったけど、時間切れに
mew-summary-thread-printがループするような場合:
┌───┐
↓ │
1─→2─→3→┘
このような場合のreferece:による参照:
┌───┐
↑ │
1←─2←─3←┘
各メッセージにつき親メッセージは1つしか指示できないため
上のようなグラフができあがることはなく
表示のときに無限ループにはまるにはことはなさそうです。
しかしループが存在するとtopから到達不可能になるため
それを検出してやる必要があります。
たとえばこんなreferece:
┌───┐
↑ │
1 2←─3←┘
━━━━━━━━━━━━━━ここから━━━━━━━━━━━━━━
*** mew-thread.el.~1~ Mon Nov 27 22:03:05 2000
--- mew-thread.el Tue Nov 28 03:51:43 2000
*************** (defvar mew-thread-indent-string " "
*** 56,62 ****
;;;
(defun mew-thread-make-entry ()
! (make-vector 4 nil))
(defmacro mew-thread-get-myid (entry)
(` (aref (, entry) 0)))
--- 56,62 ----
;;;
(defun mew-thread-make-entry ()
! (make-vector 5 nil))
(defmacro mew-thread-get-myid (entry)
(` (aref (, entry) 0)))
*************** (defmacro mew-thread-get-child (entry)
*** 70,75 ****
--- 70,78 ----
(defmacro mew-thread-get-line (entry)
(` (aref (, entry) 3)))
+ (defmacro mew-thread-get-slot (entry)
+ (` (aref (, entry) 4)))
+
(defmacro mew-thread-set-myid (entry myid)
(` (aset (, entry) 0 (, myid))))
*************** (defmacro mew-thread-set-child (entry ch
*** 82,87 ****
--- 85,92 ----
(defmacro mew-thread-set-line (entry line)
(` (aset (, entry) 3 (, line))))
+ (defmacro mew-thread-set-slot (entry n)
+ (` (aset (, entry) 4 (, n))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
*************** (defun mew-summary-make-thread (&optiona
*** 108,114 ****
(let ((msg (mew-summary-message-number))
(fld (mew-summary-folder-name)))
(mew-summary-goto-folder nil fld)
! (mew-summary-jump-message msg)))
(arg
(mew-summary-thread-region (region-beginning) (region-end)))
(t
--- 113,119 ----
(let ((msg (mew-summary-message-number))
(fld (mew-summary-folder-name)))
(mew-summary-goto-folder nil fld)
! (if msg (mew-summary-jump-message msg))))
(arg
(mew-summary-thread-region (region-beginning) (region-end)))
(t
*************** (defun mew-summary-thread-region (beg en
*** 123,129 ****
(let* ((folder (mew-summary-folder-name 'ext))
(vfolder (concat "+" folder))
(db (make-vector 211 0)) ;; prime 211 = 2 x 3 x 5 x 7 + 1
! top start me prnt prnt-cld my-id prnt-id func)
(message "Making thread ... ")
(save-restriction
(narrow-to-region beg end)
--- 128,134 ----
(let* ((folder (mew-summary-folder-name 'ext))
(vfolder (concat "+" folder))
(db (make-vector 211 0)) ;; prime 211 = 2 x 3 x 5 x 7 + 1
! top start me prnt prnt-cld my-id prnt-id func (n 0) msglist)
(message "Making thread ... ")
(save-restriction
(narrow-to-region beg end)
*************** (defun mew-summary-thread-region (beg en
*** 146,184 ****
(mew-thread-set-prntid me prnt-id)
(mew-thread-set-line me (buffer-substring start (point)))
(set (intern my-id db) me)
! (setq prnt (symbol-value (intern-soft prnt-id db)))
! (if (null prnt)
! (setq top (cons me top))
! (setq prnt-cld (mew-thread-get-child prnt))
! (if prnt-cld
! (setcdr (nthcdr (- (length prnt-cld) 1) prnt-cld) (list me))
! (mew-thread-set-child prnt (list me))))))))
! (message "Making thread ... done")
! (message "Displaying thread ... ")
(mew-summary-switch-to-folder vfolder)
(mew-erase-buffer)
(auto-show-mode 1)
(setq mew-virtual-buffer-thread-top nil)
(setq mew-virtual-buffer-thread-db db)
! (if (null mew-use-complete-thread)
! (setq mew-virtual-buffer-thread-top (nreverse top))
! ;; This may create looped thread.
! ;; See mew-use-complete-thread for more information.
! (while top
! (setq me (car top))
! (setq prnt-id (mew-thread-get-prntid me))
! (setq prnt (symbol-value (intern-soft prnt-id db)))
! (if (null prnt)
! (setq mew-virtual-buffer-thread-top
! (cons me mew-virtual-buffer-thread-top))
! (setq prnt-cld (mew-thread-get-child prnt))
! (if prnt-cld
! (setcdr (nthcdr (- (length prnt-cld) 1) prnt-cld) (list me))
! (mew-thread-set-child prnt (list me))))
! (setq top (cdr top))))
(mew-summary-thread-print-loop
mew-virtual-buffer-thread-top 0 folder
! (mew-summary-scan-form folder 'column))
(if mark (mew-mark-undo-marks (list mew-mark-review)))
(set-buffer-modified-p nil)
(if msg (mew-summary-jump-message msg))
--- 151,191 ----
(mew-thread-set-prntid me prnt-id)
(mew-thread-set-line me (buffer-substring start (point)))
(set (intern my-id db) me)
! (setq top (cons me top))
! (setq n (1+ n))))))
! (setq msglist (make-vector n nil))
(mew-summary-switch-to-folder vfolder)
(mew-erase-buffer)
(auto-show-mode 1)
(setq mew-virtual-buffer-thread-top nil)
(setq mew-virtual-buffer-thread-db db)
! (while top
! (setq me (car top))
! (aset msglist (setq n (1- n)) me)
! (mew-thread-set-slot me n)
! (setq prnt-id (mew-thread-get-prntid me))
! (setq prnt (symbol-value (intern-soft prnt-id db)))
! (if (null prnt)
! (setq mew-virtual-buffer-thread-top
! (cons me mew-virtual-buffer-thread-top))
! (setq prnt-cld (mew-thread-get-child prnt))
! (if prnt-cld
! (setcdr (nthcdr (- (length prnt-cld) 1) prnt-cld) (list me))
! (mew-thread-set-child prnt (list me))))
! (setq top (cdr top)))
! (message "Making thread ... done")
! (message "Displaying thread ... ")
(mew-summary-thread-print-loop
mew-virtual-buffer-thread-top 0 folder
! (mew-summary-scan-form folder 'column) msglist)
! (let ((i 0)
! (n (length msglist)))
! (while (< i n)
! (if (aref msglist i)
! (mew-summary-thread-print-loop
! (list (aref msglist i)) 0 folder
! (mew-summary-scan-form folder 'column) msglist))
! (setq i (1+ i))))
(if mark (mew-mark-undo-marks (list mew-mark-review)))
(set-buffer-modified-p nil)
(if msg (mew-summary-jump-message msg))
*************** (defun mew-summary-thread-region (beg en
*** 190,222 ****
;;; Visualizing thread
;;;
! (defun mew-summary-thread-print-loop (top level folder column)
(while top
! (mew-summary-thread-print (car top) level folder column)
(setq top (cdr top))))
! (defun mew-summary-thread-print (me level folder column)
! (let (cld i msg)
! (mew-elet
! (insert (mew-thread-get-line me))
! (forward-line -1)
! (beginning-of-line)
! (if (looking-at mew-regex-msg)
! (setq msg (mew-match 1))
! (setq msg ""))
! (move-to-column column)
! (setq i 0)
! (while (< i level)
! (insert mew-thread-indent-string)
! (setq i (1+ i)))
! (if (not (re-search-forward "\r" nil t))
! ()
! (insert " " folder " " msg))
! (forward-line))
! (setq cld (mew-thread-get-child me))
! (if cld
! (mew-summary-thread-print-loop cld (1+ level) folder column))))
!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Thread utilities
--- 197,232 ----
;;; Visualizing thread
;;;
! (defun mew-summary-thread-print-loop (top level folder column msglist)
(while top
! (mew-summary-thread-print (car top) level folder column msglist)
(setq top (cdr top))))
! (defun mew-summary-thread-print (me level folder column msglist)
! (if (aref msglist (mew-thread-get-slot me))
! (progn
! (aset msglist (mew-thread-get-slot me) nil)
! (let (cld i msg)
! (mew-elet
! (insert (mew-thread-get-line me))
! (forward-line -1)
! (beginning-of-line)
! (if (looking-at mew-regex-msg)
! (setq msg (mew-match 1))
! (setq msg ""))
! (move-to-column column)
! (setq i 0)
! (while (< i level)
! (insert mew-thread-indent-string)
! (setq i (1+ i)))
! (if (not (re-search-forward "\r" nil t))
! ()
! (insert " " folder " " msg))
! (forward-line))
! (setq cld (mew-thread-get-child me))
! (if cld
! (mew-summary-thread-print-loop cld (1+ level) folder column msglist))))))
!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Thread utilities
━━━━━━━━━━━━━━ここまで━━━━━━━━━━━━━━
--
KOIE Hidetaka 鯉江英隆 <hide at example.com>
Mew-dist メーリングリストの案内