X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl-summary.el;h=24ad93ac52c205cb8a3937b1b7a0959b7849fb30;hb=c50cc4923f2b8db952b90cba5534e12a436b1a5a;hp=6ecaef7d0e3abb96d52841977d0c17c64d79f7ba;hpb=e59d9b13f039bf975c614e112efaa7e58a296d16;p=elisp%2Fwanderlust.git diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 6ecaef7..24ad93a 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -1122,7 +1122,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (elmo-folder-commit wl-summary-buffer-elmo-folder) (elmo-folder-check wl-summary-buffer-elmo-folder) (if wl-use-scoring (wl-score-save)) - (if (interactive-p) (message "Saving summary status...done."))) + (if (interactive-p) (message "Saving summary status...done"))) (defun wl-summary-force-exit () "Exit current summary. Buffer is deleted even the buffer is sticky." @@ -2573,15 +2573,15 @@ If ARG, without confirm." (if (and interactive wl-summary-recenter) (recenter (/ (- (window-height) 2) 2)))))) ;; set current entity-id - (if (and (not folder) - (setq entity - (wl-folder-search-entity-by-name (elmo-folder-name-internal - folder) - wl-folder-entity - 'folder))) - ;; entity-id is unknown. - (wl-folder-set-current-entity-id - (wl-folder-get-entity-id entity))) + (when (and folder + (setq entity + (wl-folder-search-entity-by-name + (elmo-folder-name-internal folder) + wl-folder-entity + 'folder))) + ;; entity-id is unknown. + (wl-folder-set-current-entity-id + (wl-folder-get-entity-id entity))) (when (and wl-summary-lazy-highlight wl-on-xemacs) (sit-for 0)) @@ -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 @@ -2987,7 +2994,8 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (while (not (eobp)) (when (string= (wl-summary-temp-mark) mark) (setq msglist (cons (wl-summary-message-number) msglist))) - (forward-line 1))))))) + (forward-line 1)) + (nreverse msglist)))))) (defun wl-summary-exec () (interactive) @@ -2997,7 +3005,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (defun wl-summary-exec-region (beg end) (interactive "r") - (message "Collecting marks ...") + (message "Collecting marks...") (save-excursion (goto-char beg) (beginning-of-line) @@ -3026,7 +3034,7 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." refile-len dst-msgs ; loop counter result) - (message "Executing ...") + (message "Executing...") (while dels (when (not (assq (car dels) wl-summary-buffer-refile-list)) (wl-append wl-summary-buffer-refile-list @@ -3111,13 +3119,15 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (wl-summary-set-message-modified) (wl-summary-set-mark-modified) (run-hooks 'wl-summary-exec-hook) + ;; message buffer is not up-to-date (unless (and wl-message-buffer (eq (wl-summary-message-number) (with-current-buffer wl-message-buffer wl-message-buffer-cur-number))) - (wl-summary-toggle-disp-msg 'off)) + (wl-summary-toggle-disp-msg 'off) + (setq wl-message-buffer nil)) (set-buffer-modified-p nil) - (message (concat "Executing ... done" + (message (concat "Executing...done" (if (> refile-failures 0) (format " (%d refiling failed)" refile-failures) "") @@ -3174,7 +3184,8 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (setq c (+ c (char-width (following-char))))) (and (> c len) (setq folder (concat " " folder))) (setq rs (point)) - (put-text-property rs re 'invisible t) + (when wl-summary-width + (put-text-property rs re 'invisible t)) (put-text-property rs re 'wl-summary-destination t) (goto-char re) (wl-highlight-refile-destination-string folder) @@ -3757,7 +3768,7 @@ If ARG, exit virtual folder." (setq skipped (cons (car mlist) skipped))) (setq mlist (cdr mlist))) (setq wl-summary-buffer-target-mark-list skipped) - (message "Prefetching... %d/%d message(s)." count length) + (message "Prefetching... %d/%d message(s)" count length) (set-buffer-modified-p nil)))) (defun wl-summary-target-mark-refile-subr (copy-or-refile) @@ -4148,7 +4159,6 @@ If ARG, exit virtual folder." (t (format "%dB" size))) ""))) -(defvar wl-summary-line-subject-minimum-length nil) (defun wl-summary-line-subject () (let (no-parent subject parent-raw-subject parent-subject) (if (string= wl-thr-indent-string "") @@ -4163,24 +4173,12 @@ If ARG, exit virtual folder." (setq parent-subject (if parent-raw-subject (elmo-delete-char ?\n parent-raw-subject))) - (setq subject - (if (or no-parent - (null parent-subject) - (not (wl-summary-subject-equal - subject parent-subject))) - (funcall wl-summary-subject-function subject) - "")) - (when (and wl-summary-line-subject-minimum-length - (< (string-width subject) - wl-summary-line-subject-minimum-length)) - (while (< (string-width subject) - wl-summary-line-subject-minimum-length) - (setq subject (concat subject " ")))) - (if (and (not wl-summary-width) - wl-summary-subject-length-limit) - (truncate-string subject - wl-summary-subject-length-limit) - subject))) + (if (or no-parent + (null parent-subject) + (not (wl-summary-subject-equal + subject parent-subject))) + (funcall wl-summary-subject-function subject) + ""))) (defun wl-summary-line-from () (elmo-delete-char ?\n @@ -4191,7 +4189,7 @@ If ARG, exit virtual folder." (defun wl-summary-line-list-info () (let ((list-info (wl-summary-get-list-info wl-message-entity))) (if (car list-info) - (format (if (cdr list-info) "(%s %05d)" "(%s)") + (format (if (cdr list-info) "(%s %05.0f)" "(%s)") (car list-info) (cdr list-info)) ""))) @@ -4379,7 +4377,7 @@ If ARG, exit virtual folder." (wl-summary-delete-all-temp-marks) (encode-coding-region (point-min) (point-max) - (or (and wl-on-mule ; one in mcs-ltn1 cannot take 2 arg. + (or (and wl-on-mule ; one in mcs-ltn1(apel<10.4) cannot take 2 arg. (mime-charset-to-coding-system charset 'LF)) ;; Mule 2 doesn't have `*ctext*unix'. (mime-charset-to-coding-system charset)))