[Mew-dist 17749] Re: mew-highlight-summary
Shun-ichi TAHARA ( 田原 俊一 )
jado at example.com
2001年 6月 12日 (火) 03:38:29 JST
From: Hideyuki SHIRAI (白井秀行) <shirai at example.com>
Message-Id: <20010611.212211.50033305.shirai at example.com>
> > というわけで、mew-summary-hl/mew-fancy-summary をMew本体に統合(といっ
> > ても塗り方が全然違うけど)するパッチです。
> 私は *とってもものずき* なので試してみたのですが、7000通強の
> folder で
>
> 使用前: -rw-r--r-- 1,397,431 Jun 11 20:13 .mew-cache
> 使用後: -rw-r--r-- 9,369,758 Jun 11 20:00 .mew-cache
>
> (/ 9369758 1397431.0) => 6.7
>
> やっぱり、この差は大きすぎると思います。当然 goto-folder で上記
> の folder に飛んだときにも時間がかかるし。。。
XEmacs対策も兼ねて、summary cacheのセーブ/ロード方法を変更してみました。
手元では、2倍強程度の膨らみ方で済んでいます。
ただ、やはりpropertyの保存・書き戻しは少し遅いですね。
なんとかならないものかしら。
> トータルな使用感としては、もう少し処理を軽くする方策が必要かも、
> という感じです。fast-lock は参考にならないでしょうか?
まだfast-lockの使い方がよくわかってなくて… (__)
とりあえず、
From: Shun-ichi TAHARA (田原 俊一) <jado at example.com>
Message-Id: <20010611.042746.730549747.jado at example.com>
> [制限事項]
>
> ・\r 以降をinvisibleする箇所がまだ散らばってる(もはやscan時に消すべき)
> ・まだlazy-lockとかの設定をしてないけど、やっぱり遅いかな
> ・添付行の色付けはまだやってない
> ・XEmacsでは、text-propertyの持ち方が異なっている(本当に色の付いた文字
> 列が代入されている)ので、後藤さん方式が通用しない
のうち、1番目と4番目は解決してます。あとは2番目(というか高速化)と、添
付行の色付け(まだそこまで解析してないだけです (__))。
とりあえず、mew-summary-cook-regionから\r以降の不可視化を引き離して、
scan時に行なうようにしてみましたので、一度 s all しないと後ろのゴミが
見えます。
アンド、昨日のパッチから、.mew-cacheの構造が変わっていますので、これも
一度 s all が必要です。
比較的最新のMewに :-)、[Mew-dist 17737] のパッチを当てた後、添付のパッ
チを当ててください。
# 私のCVSのスキルがないに等しいため、今回のパッチは -p1 が必要です。
_______________________________
田原 俊一 jado at example.com, shunichi_tahara at example.com
http://flowernet.gr.jp/jado/
FingerPrint: 16 9E 70 3B 05 86 5D 08 B8 4C 47 3A E7 E9 8E D9
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
-------------- next part --------------
diff -rc mew.hs.orig/mew-highlight.el mew.hs/mew-highlight.el
*** mew.hs.orig/mew-highlight.el Tue Jun 12 03:21:00 2001
--- mew.hs/mew-highlight.el Tue Jun 12 01:50:25 2001
***************
*** 260,266 ****
(if (and mew-use-highlight-mouse-line window-system)
(put-text-property
start med 'mouse-face mew-highlight-mouse-line-face))
! (put-text-property med (1- (point)) 'invisible t)
(if (mew-in-decode-syntax-p)
(goto-char (mew-decode-syntax-end)))
(if (and (mew-thread-p)
--- 260,266 ----
(if (and mew-use-highlight-mouse-line window-system)
(put-text-property
start med 'mouse-face mew-highlight-mouse-line-face))
! ;;; (put-text-property med (1- (point)) 'invisible t)
(if (mew-in-decode-syntax-p)
(goto-char (mew-decode-syntax-end)))
(if (and (mew-thread-p)
diff -rc mew.hs.orig/mew-scan.el mew.hs/mew-scan.el
*** mew.hs.orig/mew-scan.el Tue Jun 12 03:21:18 2001
--- mew.hs/mew-scan.el Tue Jun 12 03:01:57 2001
***************
*** 26,32 ****
(defsubst mew-scan-highlight-substring (str beg end key &optional ext)
(if mew-use-highlight-summary
! (let ((buf str))
(put-text-property beg end 'face (mew-scan-get-face key ext) buf)
buf)
str))
--- 26,32 ----
(defsubst mew-scan-highlight-substring (str beg end key &optional ext)
(if mew-use-highlight-summary
! (let ((buf (copy-sequence str)))
(put-text-property beg end 'face (mew-scan-get-face key ext) buf)
buf)
str))
***************
*** 41,48 ****
(defsubst mew-scan-highlight-flood-string (str key &optional ext)
(if mew-use-highlight-summary
(let ((beg 0) end
! (face (mew-scan-get-face key ext))
! (buf str))
(while (setq end (next-property-change beg buf))
(mew-scan-put-face-if-nil beg end face buf)
(setq beg end))
--- 41,50 ----
(defsubst mew-scan-highlight-flood-string (str key &optional ext)
(if mew-use-highlight-summary
(let ((beg 0) end
! (face (mew-scan-get-face key ext)) buf)
! (if (text-property-not-all 0 (length str) 'face nil str)
! (setq buf str)
! (setq buf (copy-sequence str)))
(while (setq end (next-property-change beg buf))
(mew-scan-put-face-if-nil beg end face buf)
(setq beg end))
***************
*** 313,318 ****
--- 315,321 ----
(setq fld (mew-scan-get-folder mew-vec))
(setq msg (mew-scan-get-message mew-vec))
(setq ld (format "\r %s %s <%s> <%s>\n" fld msg my-id par-id)))
+ (put-text-property 0 (1- (length ld)) 'invisible t ld)
(cons line ld)))
;;
***************
*** 715,722 ****
(put-text-property
beg med 'mouse-face mew-highlight-mouse-line-face))
(goto-char med)
! (insert (cdr line))
! (put-text-property med (1- (point)) 'invisible t))
(if (or (eq opos (mew-sinfo-get-start-point))
(/= opos omax))
;; move the cursor to the original position.
--- 718,725 ----
(put-text-property
beg med 'mouse-face mew-highlight-mouse-line-face))
(goto-char med)
! (insert (cdr line)))
! ;;; (put-text-property med (1- (point)) 'invisible t))
(if (or (eq opos (mew-sinfo-get-start-point))
(/= opos omax))
;; move the cursor to the original position.
***************
*** 857,879 ****
(defsubst mew-summary-folder-cache-updatep (folder)
(mew-folder-localp folder))
(defun mew-summary-folder-cache-load ()
(let* ((folder (mew-summary-folder-name 'ext))
! (cache (mew-expand-folder folder mew-summary-cache-file)))
(if (and (mew-summary-folder-cache-updatep folder)
(file-readable-p cache)
(mew-summary-folder-cache-newp))
(mew-elet
(mew-erase-buffer)
! (insert
! (with-temp-buffer
! (mew-frwlet
! mew-cs-m17n mew-cs-dummy
! (insert-file-contents cache))
! (goto-char 1)
! (if (looking-at "#(")
! (read (current-buffer))
! (buffer-string))))
(mew-sinfo-set-cache-time (mew-file-get-time cache))
(setq mew-summary-buffer-raw t)
(mew-mark-undo-mark mew-mark-refile 'no-msg)
--- 860,918 ----
(defsubst mew-summary-folder-cache-updatep (folder)
(mew-folder-localp folder))
+ (defun mew-summary-decode-properties (len)
+ (let* ((beg (point)) (end (+ beg len)) from mid to face idt inv)
+ (while (re-search-forward
+ "\^A\\([^,\^B]*\\),\\([^,\^B]*\\),\\([^,\^B]*\\)\^B\\([^\^A]*\\)"
+ end t)
+ (setq from (match-beginning 0))
+ (setq mid (match-beginning 4))
+ (setq to (match-end 4))
+ (setq face (mew-match 1))
+ (setq face (if (equal face "") nil (intern-soft face)))
+ (setq idt (equal (mew-match 2) "T"))
+ (setq inv (equal (mew-match 3) "I"))
+ (if face (put-text-property from to 'face face))
+ (if idt (put-text-property from to 'mew-thread-point t))
+ (if inv (put-text-property from to 'invisible t))
+ (setq len (- len (- mid from)))
+ (setq end (- end (- mid from)))
+ (delete-region from mid)))
+ len)
+
+ (defun mew-summary-encode-properties (beg end)
+ (let ((pos (save-excursion (goto-char end) (beginning-of-line) (point)))
+ (buf (current-buffer)) prev ret)
+ (while (> pos (setq prev (previous-property-change pos buf beg)))
+ (let ((props (text-properties-at prev buf))
+ prop val face idt inv)
+ (while props
+ (setq prop (car props) val (car (cdr props)))
+ (cond
+ ((eq prop 'face)
+ (setq face (symbol-name val)))
+ ((eq prop 'mew-thread-point)
+ (setq idt "T"))
+ ((eq prop 'invisible)
+ (setq inv "I")))
+ (setq props (cdr (cdr props))))
+ (setq ret (cons (cons prev (concat "\^A" face "," idt "," inv "\^B"))
+ ret))
+ (setq pos prev)))
+ ret))
+
(defun mew-summary-folder-cache-load ()
(let* ((folder (mew-summary-folder-name 'ext))
! (cache (mew-expand-folder folder mew-summary-cache-file))
! (after-insert-file-functions '(mew-summary-decode-properties)))
(if (and (mew-summary-folder-cache-updatep folder)
(file-readable-p cache)
(mew-summary-folder-cache-newp))
(mew-elet
(mew-erase-buffer)
! (mew-frwlet
! mew-cs-m17n mew-cs-dummy
! (insert-file-contents cache))
(mew-sinfo-set-cache-time (mew-file-get-time cache))
(setq mew-summary-buffer-raw t)
(mew-mark-undo-mark mew-mark-refile 'no-msg)
***************
*** 881,900 ****
(defun mew-summary-folder-cache-save ()
(let* ((folder (mew-summary-folder-name 'ext))
! (cache (mew-expand-folder folder mew-summary-cache-file)))
(if (and (mew-summary-folder-cache-updatep folder)
(file-writable-p cache))
(save-restriction
(widen)
! (let* ((min (point-min))
! (max (point-max))
! (beg (mew-decode-syntax-begin))
! (end (mew-decode-syntax-end))
! (str (concat (buffer-substring min (or beg min))
! (buffer-substring (or end min) max))))
(with-temp-buffer
(mew-erase-buffer)
! (prin1 str (current-buffer))
(mew-frwlet
mew-cs-dummy mew-cs-m17n
(write-region (point-min) (point-max) cache nil 'no-msg))))
--- 920,943 ----
(defun mew-summary-folder-cache-save ()
(let* ((folder (mew-summary-folder-name 'ext))
! (cache (mew-expand-folder folder mew-summary-cache-file))
! (write-region-annotate-functions '(mew-summary-encode-properties)))
(if (and (mew-summary-folder-cache-updatep folder)
(file-writable-p cache))
(save-restriction
(widen)
! (let ((cbuf (current-buffer))
! (min (point-min))
! (max (point-max))
! (beg (mew-decode-syntax-begin))
! (end (mew-decode-syntax-end)))
(with-temp-buffer
(mew-erase-buffer)
! (insert
! (save-excursion
! (set-buffer cbuf)
! (concat (buffer-substring min (or beg min))
! (buffer-substring (or end min) max))))
(mew-frwlet
mew-cs-dummy mew-cs-m17n
(write-region (point-min) (point-max) cache nil 'no-msg))))
Mew-dist メーリングリストの案内