[Mew-dist 15299] Re: thread

Shun-ichi TAHARA ( 田原 俊一 ) jado at example.com
2000年 12月 6日 (水) 12:06:26 JST


From: Shun-ichi TAHARA (田原 俊一) <shunichi_tahara at example.com>
Message-Id: <20001206.120358.468731403.z1980163 at example.com>

> というわけで、とりあえず、この線でパッチです。

といいながら、肝心のパッチを付けてませんでした。スミマセン。
-------------- next part --------------
*** mew-thread.el.orig	Tue Dec  5 00:39:24 2000
--- mew-thread.el	Wed Dec  6 11:30:53 2000
*************** (defvar mew-thread-indent-string "  "
*** 53,58 ****
--- 53,85 ----
  (defvar mew-thread-indent-array nil)
  (defvar mew-thread-indent-array-size 33) ;; devide by 32
  
+ (defvar mew-use-fancy-thread nil
+   "*If non-nil, use fancy style thread visualization.
+ See also mew-fancy-thread-indent-strings.")
+ 
+ (defvar mew-fancy-thread-indent-strings
+   [" +" " +" " |" "  "]
+   "*Vector of string to be used for indentation of fancy style thread.
+ Valid only if mew-use-fancy-thread is non-nil.
+ 
+ This is consist of four members; 1st member is to prefix the child
+ message that is not the last one, 2nd is to prefix the last child, 3rd
+ and 4th are to prefix grand-child thread tree, 4th is for the child
+ tree of the last chile message.
+ For example, [ \" +\" \" +\" \" |\" \"  \" ] makes thread view below.
+ 
+     Message 1
+      +Message 2
+      | +Message 3
+      +Message 4
+        +Message 5
+ 
+ All members must have same lengths.")
+ 
+ (defvar mew-thread-indent-length nil)
+ (defvar mew-thread-indent-regex nil)
+ (defvar mew-thread-indent-lregex nil)
+ 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  ;;; Thread info macro
*************** (defmacro mew-thread-set-line (entry lin
*** 98,112 ****
  ;;;
  
  (defun mew-thread-setup ()
!   (let* ((i 0)
! 	 (size mew-thread-indent-array-size)
! 	 (array (make-vector size nil))
! 	 (indent ""))
!     (while (< i size)
!       (aset array i indent)
!       (setq i (1+ i))
!       (setq indent (concat indent mew-thread-indent-string)))
!     (setq mew-thread-indent-array array)))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
--- 125,169 ----
  ;;;
  
  (defun mew-thread-setup ()
!   (cond
!    (mew-use-fancy-thread
!     (let ((idt1 (aref mew-fancy-thread-indent-strings 0))
! 	  (idt2 (aref mew-fancy-thread-indent-strings 1))
! 	  (idt3 (aref mew-fancy-thread-indent-strings 2))
! 	  (idt4 (aref mew-fancy-thread-indent-strings 3)))
!       (if (and (= (length idt1) (length idt2))
! 	       (= (length idt2) (length idt3))
! 	       (= (length idt3) (length idt4)))
! 	  ()
! 	(error
! 	 "\
! All members of mew-fancy-thread-indent-strings must have same lengths."))
!       (setq mew-thread-indent-length (length idt1))
!       (setq mew-thread-indent-regex
! 	    (concat "\\(" (regexp-quote idt1) "\\|" (regexp-quote idt2)
! 		    "\\|" (regexp-quote idt3) "\\|" (regexp-quote idt4) "\\)"))
!       (setq mew-thread-indent-lregex
! 	    (concat "[^"
! 		    (regexp-quote
! 		     (format "%c%c%c%c"
! 			     (aref idt1 0) (aref idt2 0)
! 			     (aref idt3 0) (aref idt4 0))) "]"))))
!    (t
!     (let* ((i 0)
! 	   (size mew-thread-indent-array-size)
! 	   (array (make-vector size nil))
! 	   (indent ""))
!       (while (< i size)
! 	(aset array i indent)
! 	(setq i (1+ i))
! 	(setq indent (concat indent mew-thread-indent-string)))
!       (setq mew-thread-indent-array array))
!     (setq mew-thread-indent-length (length mew-thread-indent-string))
!     (setq mew-thread-indent-regex (regexp-quote mew-thread-indent-string))
!     (setq mew-thread-indent-lregex
! 	  (concat "[^"
! 		  (regexp-quote
! 		   (format "%c" (aref mew-thread-indent-string 0))) "]")))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
*************** (defun mew-summary-thread-region (beg en
*** 259,267 ****
         (setq tm4 (current-time))
         (message "Displaying thread ... ")
         (setq tm5 (current-time))
!        (mew-summary-thread-print-loop
! 	mew-virtual-buffer-thread-top 0 folder
! 	(mew-summary-scan-form folder 'column))
         (setq tm6 (current-time))
         ;;
         (if mark (mew-mark-undo-marks (list mew-mark-review)))
--- 316,330 ----
         (setq tm4 (current-time))
         (message "Displaying thread ... ")
         (setq tm5 (current-time))
!        (cond
! 	(mew-use-fancy-thread
! 	 (mew-summary-fancy-thread-print-loop
! 	  mew-virtual-buffer-thread-top 0 folder
! 	  (mew-summary-scan-form folder 'column) ""))
! 	(t
! 	 (mew-summary-thread-print-loop
! 	  mew-virtual-buffer-thread-top 0 folder
! 	  (mew-summary-scan-form folder 'column))))
         (setq tm6 (current-time))
         ;;
         (if mark (mew-mark-undo-marks (list mew-mark-review)))
*************** (defun mew-summary-thread-print (me leve
*** 312,317 ****
--- 375,419 ----
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
+ ;;; Visualizing thread (fancy style)
+ ;;;
+ 
+ (defun mew-summary-fancy-thread-print-loop (top level folder column prefix)
+   (while top
+     ;; xx
+     (let ((next (cdr top))
+ 	  i idt1 idt2)
+       (if next
+ 	  (setq i 0)
+ 	(setq i 1))
+       (cond ((= level 0)
+ 	     (setq idt1 "")
+ 	     (setq idt2 ""))
+ 	    (t
+ 	     (setq idt1 (aref mew-thread-indent-strings i))
+ 	     (setq idt2 (aref mew-thread-indent-strings (+ i 2)))))
+       (mew-summary-fancy-thread-print (car top) level folder column
+ 				      idt1 idt2 prefix)
+       (setq top next))))
+ 
+ (defun mew-summary-fancy-thread-print (me level folder column idt1 idt2 prefix)
+   (let (cld)
+     (mew-elet
+      (insert (mew-thread-get-line me))
+      (forward-line -1)
+      (move-to-column column)
+      (insert prefix idt1)
+      (if (not (search-forward "\r" nil t))
+ 	 ()
+        (insert " " folder " " (mew-thread-get-msg me)))
+      (forward-line))
+     (setq cld (mew-thread-get-child me))
+     (if cld
+ 	(mew-summary-fancy-thread-print-loop
+ 	 cld (1+ level) folder column (concat prefix idt2)))))
+ 
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ ;;;
  ;;; Thread utilities
  ;;;
  
*************** (defun mew-summary-mark-select-thread ()
*** 320,335 ****
    (interactive)
    (let* ((folder (mew-summary-folder-name))
  	 (column (mew-summary-scan-form folder 'column))
- 	 (len (length mew-thread-indent-string))
- 	 (fregex (regexp-quote mew-thread-indent-string))
  	 (regex ""))
      (save-excursion
        (move-to-column column)
!       (while (looking-at fregex)
! 	(setq regex (concat regex mew-thread-indent-string))
! 	(forward-char len))
!       (setq regex (concat regex mew-thread-indent-string))
!       (setq regex (regexp-quote regex))
        (mew-summary-review-one 'no-msg)
        (forward-line)
        (catch 'loop
--- 422,434 ----
    (interactive)
    (let* ((folder (mew-summary-folder-name))
  	 (column (mew-summary-scan-form folder 'column))
  	 (regex ""))
      (save-excursion
        (move-to-column column)
!       (while (looking-at mew-thread-indent-regex)
! 	(setq regex (concat regex mew-thread-indent-regex))
! 	(forward-char mew-thread-indent-length))
!       (setq regex (concat regex mew-thread-indent-regex))
        (mew-summary-review-one 'no-msg)
        (forward-line)
        (catch 'loop
*************** (defun mew-summary-thread-up ()
*** 347,360 ****
    (mew-virtual-only
     (let* ((folder (substring (mew-summary-folder-name 'ext) 1))
  	  (column (mew-summary-scan-form folder 'column))
- 	  (regex (regexp-quote mew-thread-indent-string))
  	  here)
       (save-excursion
         (forward-line -1)
         (catch 'loop
  	 (while (not (bobp))
  	   (move-to-column column)
! 	   (if (looking-at regex)
  	       (forward-line -1)
  	     (throw 'loop (setq here (point)))))))
       (if here
--- 446,458 ----
    (mew-virtual-only
     (let* ((folder (substring (mew-summary-folder-name 'ext) 1))
  	  (column (mew-summary-scan-form folder 'column))
  	  here)
       (save-excursion
         (forward-line -1)
         (catch 'loop
  	 (while (not (bobp))
  	   (move-to-column column)
! 	   (if (looking-at mew-thread-indent-regex)
  	       (forward-line -1)
  	     (throw 'loop (setq here (point)))))))
       (if here
*************** (defun mew-summary-thread-down ()
*** 370,383 ****
    (mew-virtual-only
     (let* ((folder (substring (mew-summary-folder-name 'ext) 1))
  	  (column (mew-summary-scan-form folder 'column))
- 	  (regex (regexp-quote mew-thread-indent-string))
  	  here)
       (save-excursion
         (forward-line)
         (catch 'loop
  	 (while (not (eobp))
  	   (move-to-column column)
! 	   (if (looking-at regex)
  	       (forward-line)
  	     (throw 'loop (setq here (point)))))))
       (if here
--- 468,480 ----
    (mew-virtual-only
     (let* ((folder (substring (mew-summary-folder-name 'ext) 1))
  	  (column (mew-summary-scan-form folder 'column))
  	  here)
       (save-excursion
         (forward-line)
         (catch 'loop
  	 (while (not (eobp))
  	   (move-to-column column)
! 	   (if (looking-at mew-thread-indent-regex)
  	       (forward-line)
  	     (throw 'loop (setq here (point)))))))
       (if here
*************** (defun mew-summary-thread-parent ()
*** 393,413 ****
    (mew-virtual-only
     (let* ((folder (mew-summary-folder-name))
  	  (column (mew-summary-scan-form folder 'column))
- 	  (len (length mew-thread-indent-string))
- 	  (fregex (regexp-quote mew-thread-indent-string))
  	  (regex "") lregex movep)
       (save-excursion
         (move-to-column column)
!        (if (not (looking-at fregex))
  	   ()
  	 (setq movep t)
! 	 (forward-char len)
! 	 (while (looking-at fregex)
! 	   (setq regex (concat regex mew-thread-indent-string))
! 	   (forward-char len))))
!      (setq lregex (concat (regexp-quote regex)
! 			  (format "[^%c]" (aref mew-thread-indent-string 0))))
!      (setq regex (regexp-quote regex))
       (if movep
  	 (catch 'loop
  	   (while t
--- 490,506 ----
    (mew-virtual-only
     (let* ((folder (mew-summary-folder-name))
  	  (column (mew-summary-scan-form folder 'column))
  	  (regex "") lregex movep)
       (save-excursion
         (move-to-column column)
!        (if (not (looking-at mew-thread-indent-regex))
  	   ()
  	 (setq movep t)
! 	 (forward-char mew-thread-indent-length)
! 	 (while (looking-at mew-thread-indent-regex)
! 	   (setq regex (concat regex mew-thread-indent-regex))
! 	   (forward-char mew-thread-indent-length))))
!      (setq lregex (concat regex mew-thread-indent-lregex))
       (if movep
  	 (catch 'loop
  	   (while t


Mew-dist メーリングリストの案内