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)
(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))
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)
(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