From 20c639e4f181e0a2ec45be8bbbb1e5fe9eb6dc12 Mon Sep 17 00:00:00 2001 From: teranisi Date: Sat, 12 Oct 2002 07:50:03 +0000 Subject: [PATCH] * wl-summary.el (wl-summary-insert-headers): Put alike hash in reverse order. (wl-summary-search-by-subject): Search parent message from tail; Check the existence of the parent message on the current thread tree. (wl-summary-update-thread): Check whether the line is inserted. --- wl/ChangeLog | 8 +++++ wl/wl-summary.el | 87 +++++++++++++++++++++++++++++------------------------- wl/wl-thread.el | 13 +++----- 3 files changed, 59 insertions(+), 49 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index d021a24..d907337 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,11 @@ +2002-10-12 Yuuichi Teranishi + + * wl-summary.el (wl-summary-insert-headers): Put alike hash in reverse + order. + (wl-summary-search-by-subject): Search parent message from tail; + Check the existence of the parent message on the current thread tree. + (wl-summary-update-thread): Check whether the line is inserted. + 2002-10-10 Yoichi NAKAYAMA * wl-vars.el (wl-summary-line-format): Undo last change. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 2ca0fd9..ade5c04 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -2661,7 +2661,6 @@ If ARG, without confirm." wl-summary-alike-hashtb))) (defun wl-summary-insert-headers (overview func mime-decode) - (message "Creating subject cache...") (let (ov this last alike) (buffer-disable-undo (current-buffer)) (make-local-variable 'wl-summary-alike-hashtb) @@ -2672,7 +2671,7 @@ If ARG, without confirm." (setq this (funcall func ov)) (and this (setq this (std11-unfold-string this))) (if (equal last this) - (wl-append alike (list ov)) + (setq alike (cons ov alike)) (when last (wl-summary-put-alike alike) (insert last ?\n)) @@ -2686,54 +2685,59 @@ If ARG, without confirm." elmo-mime-charset) (when (eq mime-decode 'mime) (eword-decode-region (point-min) (point-max)))) - (message "Creating subject cache...done") (run-hooks 'wl-summary-insert-headers-hook))) (defun wl-summary-search-by-subject (entity overview) (let ((summary-buf (current-buffer)) (buf (get-buffer-create wl-summary-search-buf-name)) (folder-name (wl-summary-buffer-folder-name)) - match founds found-entity) + match founds cur result) (with-current-buffer buf (let ((case-fold-search t)) (when (or (not (string= wl-summary-search-buf-folder-name folder-name)) (zerop (buffer-size))) (setq wl-summary-search-buf-folder-name folder-name) + (message "Creating subject cache...") (wl-summary-insert-headers overview (function (lambda (x) (funcall wl-summary-subject-filter-function - (elmo-msgdb-overview-entity-get-subject-no-decode x)))) - t)) + (elmo-msgdb-overview-entity-get-subject-no-decode x)))) + t) + (message "Creating subject cache...done")) (setq match (funcall wl-summary-subject-filter-function (elmo-msgdb-overview-entity-get-subject entity))) (if (string= match "") (setq match "\n")) - (goto-char (point-min)) - (while (and (not founds) - (not (= (point) (point-max))) - (search-forward match nil t)) + (goto-char (point-max)) + (while (and (null result) + (not (= (point) (point-min))) + (search-backward match nil t)) ;; check exactly match - (when (and (eolp) - (= (point-at-bol) - (match-beginning 0))) - (setq found-entity (wl-summary-get-alike)) - (if (and found-entity - ;; Is founded entity myself or children? - (not (string= - (elmo-msgdb-overview-entity-get-id entity) - (elmo-msgdb-overview-entity-get-id - (car found-entity)))) - (with-current-buffer summary-buf + (when (and (bolp) (= (point-at-eol)(match-end 0))) + (setq founds (wl-summary-get-alike)) + (with-current-buffer summary-buf + (while founds + (when (and + ;; the first element of found-entity list exists on + ;; thread tree. + (wl-thread-get-entity + (elmo-msgdb-overview-entity-get-number + (car founds))) + ;; message id is not same as myself. + (not (string= + (elmo-msgdb-overview-entity-get-id entity) + (elmo-msgdb-overview-entity-get-id (car founds)))) + ;; not a descendant. (not (wl-thread-descendant-p (elmo-msgdb-overview-entity-get-number entity) (elmo-msgdb-overview-entity-get-number - (car found-entity)))))) - ;; return matching entity - (setq founds found-entity)))) - (if founds - (car founds)))))) + (car founds))))) + (setq result (car founds) + founds nil)) + (setq founds (cdr founds)))))) + result)))) (defun wl-summary-insert-thread-entity (entity msgdb update &optional force-insert) @@ -2812,26 +2816,29 @@ If ARG, without confirm." (overview-entity entity) (parent-id (elmo-msgdb-overview-entity-get-id parent-entity)) (number (elmo-msgdb-overview-entity-get-number entity)) - (parent-number (elmo-msgdb-overview-entity-get-number parent-entity))) + (parent-number (elmo-msgdb-overview-entity-get-number parent-entity)) + insert-line) (cond ((or (not parent-id) (string= this-id parent-id)) (goto-char (point-max)) - (beginning-of-line)) + (beginning-of-line) + (setq insert-line t)) ;; parent already exists in buffer. ((wl-summary-jump-to-msg parent-number) - (wl-thread-goto-bottom-of-sub-thread))) - (let ((inhibit-read-only t) - (buffer-read-only nil)) - (wl-summary-insert-line - (wl-summary-create-line - entity - parent-entity - nil - (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) number) - (wl-thread-maybe-get-children-num number) - (wl-thread-make-indent-string thr-entity) - (wl-thread-entity-get-linked thr-entity)))))) + (wl-thread-goto-bottom-of-sub-thread) + (setq insert-line t))) + (when insert-line + (let (buffer-read-only) + (wl-summary-insert-line + (wl-summary-create-line + entity + parent-entity + nil + (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) number) + (wl-thread-maybe-get-children-num number) + (wl-thread-make-indent-string thr-entity) + (wl-thread-entity-get-linked thr-entity))))))) (defun wl-summary-mark-as-unread (&optional number no-server-update diff --git a/wl/wl-thread.el b/wl/wl-thread.el index 2839ee7..5e5bca3 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -259,20 +259,15 @@ "If parent of ENTITY is invisible, the top invisible ancestor entity of ENTITY is returned." (let ((cur-entity entity) - ret-val) + top) (catch 'done (while (setq cur-entity (wl-thread-entity-get-parent-entity cur-entity)) (if (null (wl-thread-entity-get-number cur-entity)) - ;; top!! - (progn - ;;(setq ret-val nil) - (throw 'done nil)) + (throw 'done nil) (when (not (wl-thread-entity-get-opened cur-entity)) - ;; not opened!! - (setq ret-val cur-entity))))) - ;; top of closed entity in the path. - ret-val)) + (setq top cur-entity))))) + top)) (defun wl-thread-entity-get-nearly-older-brother (entity &optional parent) (let ((brothers (wl-thread-entity-get-older-brothers entity parent))) -- 1.7.10.4