From daef476592dbf12b92c90eaea45fd532bc8a7604 Mon Sep 17 00:00:00 2001 From: teranisi Date: Thu, 2 May 2002 10:33:11 +0000 Subject: [PATCH] * wl-vars.el (wl-summary-line-format-spec-alist): New variable. (wl-summary-line-format): New user option. (wl-folder-summary-line-format-alist): Ditto. (wl-summary-from-width): Abolished. * wl-util.el (toplevel): Require 'bytecomp. (wl-line-parse-format): New function. (wl-line-formatter-setup): New macro. * wl-summary.el (wl-summary-buffer-number-regexp): Abolished. (wl-summary-buffer-line-formatter): New buffer local variable. (wl-summary-switch-to-clone-buffer): Follow the change above. (wl-summary-message-regexp): Fix. (wl-summary-from-func-internal): Abolished. (wl-summary-subject-func-internal): Ditto. (wl-summary-subject-filter-func-internal): Ditto. (All other related portions are changed.) (wl-summary-buffer-set-folder): Set up wl-summary-buffer-number-column and wl-summary-buffer-line-formatter (All other related portions are changed.) (wl-summary-buffer-number-column-detect): Abolished. (All other related portions are changed.) (wl-summary-delete-all-status-marks-on-buffer): Removed. (wl-summary-delete-all-temp-marks-on-buffer): Use wl-summary-message-regexp instead of wl-summary-buffer-number-regexp. (wl-summary-target-mark-delete): Ditto. (wl-summary-target-mark-refile-subr): Ditto. (wl-summary-target-mark-mark-as-read): Ditto. (wl-summary-target-mark-mark-as-unread): Ditto. (wl-summary-target-mark-mark-as-important): Ditto. (wl-summary-target-mark-save): Ditto. (wl-summary-replace-status-marks): Renamed from wl-summary-set-status-marks-on-buffer; Use wl-summary-message-regexp instead of wl-summary-buffer-number-regexp. (wl-summary-sync-update): Follow the change above. (wl-summary-goto-previous-message-beginning): New function. (wl-summary-mark-as-unread): Use it. (wl-summary-mark-as-important): Ditto. (wl-summary-line-formatter): New variable. (wl-summary-line-year): New function. (wl-summary-line-day): Ditto. (wl-summary-line-day-of-week): Ditto. (wl-summary-line-hour): Ditto. (wl-summary-line-minute): Ditto. (wl-summary-line-open-bracket): Ditto. (wl-summary-line-close-bracket): Ditto. (wl-summary-line-children-number): Ditto. (wl-summary-line-thread-indent): Ditto. (wl-summary-line-size): Ditto. (wl-summary-line-subject): Ditto. (wl-summary-line-from): Ditto. (wl-summary-line-children-and-from): Ditto. (wl-summary-create-line): Rewritten. (wl-summary-format-date): Abolished. * wl-highlight.el (wl-highlight-summary-current-line): Use wl-summary-message-regexp instead of wl-summary-buffer-number-regexp; Use thread structure to detect thread top message. * wl-draft.el (wl-default-draft-cite): Don't use wl-summary-from-func-internal. * wl-refile.el (wl-refile-subject-learn): Don't use wl-summary-subject-filter-func-internal. (wl-refile-guess-by-subject): Ditto. * wl-e21.el (wl-e21-toolbar-configurations): Changed default parameters. * wl-thread.el (wl-thread-update-indent-string-region): Use wl-thread-update-line-on-buffer instead of wl-thread-update-indent-string. (wl-thread-update-children-number): Redefine using wl-thread-update-line-on-buffer. (wl-thread-update-indent-string): Abolished. * elmo-msgdb.el (elmo-msgdb-get-mark): Fix docstring. (elmo-msgdb-set-mark): Ditto. --- elmo/elmo-msgdb.el | 5 +- wl/ChangeLog | 78 +++++++++++++ wl/wl-draft.el | 4 +- wl/wl-e21.el | 4 +- wl/wl-highlight.el | 23 ++-- wl/wl-refile.el | 8 +- wl/wl-summary.el | 326 +++++++++++++++++++++++++++------------------------- wl/wl-thread.el | 74 +----------- wl/wl-util.el | 39 ++++++- wl/wl-vars.el | 63 ++++++++-- 10 files changed, 361 insertions(+), 263 deletions(-) diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index bfe4b9f..18c28a7 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -52,12 +52,13 @@ msgdb)) (defsubst elmo-msgdb-get-mark (msgdb number) - "Get mark from MSGDB which corresponds to the message with NUMBER." + "Get mark string from MSGDB which corresponds to the message with NUMBER." (cadr (elmo-get-hash-val (format "#%d" number) (elmo-msgdb-get-mark-hashtb msgdb)))) (defsubst elmo-msgdb-set-mark (msgdb number mark) - "Set MARK of the message with NUMBER in the MSGDB." + "Set MARK of the message with NUMBER in the MSGDB. +if MARK is nil, mark is removed." (elmo-msgdb-set-mark-alist msgdb (elmo-msgdb-mark-alist-set (elmo-msgdb-get-mark-alist msgdb) diff --git a/wl/ChangeLog b/wl/ChangeLog index 66cdc8f..ea3064d 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,83 @@ 2002-05-02 Yuuichi Teranishi + * wl-vars.el (wl-summary-line-format-spec-alist): New variable. + (wl-summary-line-format): New user option. + (wl-folder-summary-line-format-alist): Ditto. + (wl-summary-from-width): Abolished. + + * wl-util.el (toplevel): Require 'bytecomp. + (wl-line-parse-format): New function. + (wl-line-formatter-setup): New macro. + + * wl-summary.el (wl-summary-buffer-number-regexp): Abolished. + (wl-summary-buffer-line-formatter): New buffer local variable. + (wl-summary-switch-to-clone-buffer): Follow the change above. + (wl-summary-message-regexp): Fix. + (wl-summary-from-func-internal): Abolished. + (wl-summary-subject-func-internal): Ditto. + (wl-summary-subject-filter-func-internal): Ditto. + (All other related portions are changed.) + (wl-summary-buffer-set-folder): + Set up wl-summary-buffer-number-column and + wl-summary-buffer-line-formatter + (All other related portions are changed.) + (wl-summary-buffer-number-column-detect): Abolished. + (All other related portions are changed.) + (wl-summary-delete-all-status-marks-on-buffer): Removed. + (wl-summary-delete-all-temp-marks-on-buffer): Use + wl-summary-message-regexp instead of wl-summary-buffer-number-regexp. + (wl-summary-target-mark-delete): Ditto. + (wl-summary-target-mark-refile-subr): Ditto. + (wl-summary-target-mark-mark-as-read): Ditto. + (wl-summary-target-mark-mark-as-unread): Ditto. + (wl-summary-target-mark-mark-as-important): Ditto. + (wl-summary-target-mark-save): Ditto. + (wl-summary-replace-status-marks): Renamed from + wl-summary-set-status-marks-on-buffer; + Use wl-summary-message-regexp instead of + wl-summary-buffer-number-regexp. + (wl-summary-sync-update): Follow the change above. + (wl-summary-goto-previous-message-beginning): New function. + (wl-summary-mark-as-unread): Use it. + (wl-summary-mark-as-important): Ditto. + (wl-summary-line-formatter): New variable. + (wl-summary-line-year): New function. + (wl-summary-line-day): Ditto. + (wl-summary-line-day-of-week): Ditto. + (wl-summary-line-hour): Ditto. + (wl-summary-line-minute): Ditto. + (wl-summary-line-open-bracket): Ditto. + (wl-summary-line-close-bracket): Ditto. + (wl-summary-line-children-number): Ditto. + (wl-summary-line-thread-indent): Ditto. + (wl-summary-line-size): Ditto. + (wl-summary-line-subject): Ditto. + (wl-summary-line-from): Ditto. + (wl-summary-line-children-and-from): Ditto. + (wl-summary-create-line): Rewritten. + (wl-summary-format-date): Abolished. + + * wl-highlight.el (wl-highlight-summary-current-line): Use + wl-summary-message-regexp instead of wl-summary-buffer-number-regexp; + Use thread structure to detect thread top message. + + * wl-draft.el (wl-default-draft-cite): Don't use + wl-summary-from-func-internal. + + * wl-refile.el (wl-refile-subject-learn): Don't use + wl-summary-subject-filter-func-internal. + (wl-refile-guess-by-subject): Ditto. + + * wl-e21.el (wl-e21-toolbar-configurations): Changed default + parameters. + + * wl-thread.el (wl-thread-update-indent-string-region): + Use wl-thread-update-line-on-buffer instead of + wl-thread-update-indent-string. + (wl-thread-update-children-number): Redefine using + wl-thread-update-line-on-buffer. + (wl-thread-update-indent-string): Abolished. + * Version number is increased to 2.9.11. 2002-05-01 Yuuichi Teranishi diff --git a/wl/wl-draft.el b/wl/wl-draft.el index f6f280f..e71640a 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -670,8 +670,8 @@ Reply to author if WITH-ARG is non-nil." (setq cite-title (format "At %s,\n%s wrote:" (or date "some time ago") (if wl-default-draft-cite-decorate-author - (wl-summary-from-func-internal - (or from "you")) + (funcall wl-summary-from-function + (or from "you")) (or from "you")))))) (and cite-title (insert cite-title "\n")) diff --git a/wl/wl-e21.el b/wl/wl-e21.el index 8facf59..00bd461 100644 --- a/wl/wl-e21.el +++ b/wl/wl-e21.el @@ -202,8 +202,8 @@ (defvar wl-e21-toolbar-configurations '((auto-resize-tool-bars . t) (auto-raise-tool-bar-buttons . t) - (tool-bar-button-margin . 0) - (tool-bar-button-relief . 2))) + (tool-bar-button-margin . 2) + (tool-bar-button-relief . 1))) (defun wl-e21-make-toolbar-buttons (keymap defs) (let ((configs wl-e21-toolbar-configurations) diff --git a/wl/wl-highlight.el b/wl/wl-highlight.el index bbb0e1f..57c831d 100644 --- a/wl/wl-highlight.el +++ b/wl/wl-highlight.el @@ -818,12 +818,7 @@ (let ((inhibit-read-only t) (case-fold-search nil) temp-mark status-mark (deactivate-mark nil) - (sregexp (concat - "^" - wl-summary-buffer-number-regexp - "\\(.\\)\\(.\\)../..\(.*\)..:.. \\(" - wl-highlight-thread-indent-string-regexp - "\\)[[<]")) + (sregexp (concat "\\("wl-summary-message-regexp "\\)\\(.\\)\\(.\\)")) fregexp fsymbol bol eol matched thread-top looked-at dest ds) (end-of-line) (setq eol (point)) @@ -833,14 +828,14 @@ (setq status-mark smark) (setq looked-at (looking-at sregexp)) (when looked-at - (setq status-mark (buffer-substring (match-beginning 2) - (match-end 2))))) + (setq status-mark (buffer-substring (match-beginning 3) + (match-end 3))))) (when temp-too (unless looked-at (setq looked-at (looking-at sregexp))) (when looked-at - (setq temp-mark (buffer-substring (match-beginning 1) - (match-end 1))) + (setq temp-mark (buffer-substring (match-beginning 2) + (match-end 2))) (cond ((string= temp-mark "*") (setq fsymbol 'wl-highlight-summary-temp-face)) @@ -877,10 +872,10 @@ ((string= temp-mark "+") (setq fsymbol 'wl-highlight-summary-high-read-face)) ;; - (t (if (and looked-at - (string= (buffer-substring - (match-beginning 3) - (match-end 3)) "")) + (t (if (null + (wl-thread-entity-get-parent-entity + (wl-thread-get-entity (string-to-number + (match-string 1))))) (setq fsymbol 'wl-highlight-summary-thread-top-face) (setq fsymbol 'wl-highlight-summary-normal-face))))) (put-text-property bol eol 'face fsymbol) diff --git a/wl/wl-refile.el b/wl/wl-refile.el index bba8e51..6156774 100644 --- a/wl/wl-refile.el +++ b/wl/wl-refile.el @@ -132,8 +132,8 @@ wl-refile-msgid-alist)))))) (defun wl-refile-subject-learn (entity dst) - (let ((subject (wl-summary-subject-filter-func-internal - (elmo-msgdb-overview-entity-get-subject entity))) + (let ((subject (funcall wl-summary-subject-filter-function + (elmo-msgdb-overview-entity-get-subject entity))) hit) (setq dst (elmo-string dst)) (if (and subject (not (string= subject ""))) @@ -258,8 +258,8 @@ If RULE does not match ENTITY, returns nil." wl-refile-msgid-alist))) (defun wl-refile-guess-by-subject (entity) - (cdr (assoc (wl-summary-subject-filter-func-internal - (elmo-msgdb-overview-entity-get-subject entity)) + (cdr (assoc (funcall wl-summary-subject-filter-function + (elmo-msgdb-overview-entity-get-subject entity)) wl-refile-subject-alist))) (require 'product) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index b15675e..54c2344 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -93,7 +93,6 @@ (defvar wl-summary-buffer-mark-modified nil) (defvar wl-summary-buffer-thread-modified nil) (defvar wl-summary-buffer-number-column nil) -(defvar wl-summary-buffer-number-regexp nil) (defvar wl-summary-buffer-persistent nil) (defvar wl-summary-buffer-thread-nodes nil) (defvar wl-summary-buffer-target-mark-list nil) @@ -108,6 +107,7 @@ (defvar wl-summary-buffer-number-list nil) (defvar wl-summary-buffer-msgdb nil) (defvar wl-summary-buffer-folder-name nil) +(defvar wl-summary-buffer-line-formatter nil) (defvar wl-thread-indent-level-internal nil) (defvar wl-thread-have-younger-brother-str-internal nil) @@ -126,7 +126,8 @@ (defvar wl-summary-get-petname-function 'wl-address-get-petname-1) -(defvar wl-summary-message-regexp "^ *\\(-?[0-9]+\\)") +(defconst wl-summary-message-regexp "^ *-?[0-9]+" + "Regexp for the message.") (defvar wl-summary-shell-command-last "") @@ -154,7 +155,6 @@ (make-variable-buffer-local 'wl-summary-buffer-mark-modified) (make-variable-buffer-local 'wl-summary-buffer-thread-modified) (make-variable-buffer-local 'wl-summary-buffer-number-column) -(make-variable-buffer-local 'wl-summary-buffer-number-regexp) (make-variable-buffer-local 'wl-summary-buffer-persistent) (make-variable-buffer-local 'wl-summary-buffer-thread-nodes) (make-variable-buffer-local 'wl-summary-buffer-prev-refile-destination) @@ -179,20 +179,12 @@ (make-variable-buffer-local 'wl-summary-buffer-number-list) (make-variable-buffer-local 'wl-summary-buffer-msgdb) (make-variable-buffer-local 'wl-summary-buffer-folder-name) +(make-variable-buffer-local 'wl-summary-buffer-line-formatter) ;; internal functions (dummy) (unless (fboundp 'wl-summary-append-message-func-internal) (defun wl-summary-append-message-func-internal (entity msgdb update &optional force-insert))) -(unless (fboundp 'wl-summary-from-func-internal) - (defun wl-summary-from-func-internal (from) - from)) -(unless (fboundp 'wl-summary-subject-func-internal) - (defun wl-summary-subject-func-internal (subject) - subject)) -(unless (fboundp 'wl-summary-subject-filter-func-internal) - (defun wl-summary-subject-filter-func-internal (subject) - subject)) (defmacro wl-summary-sticky-buffer-name (name) (` (concat wl-summary-buffer-name ":" (, name)))) @@ -711,6 +703,17 @@ you." (wl-get-assoc-list-value wl-folder-thread-indent-set-alist (elmo-folder-name-internal folder))) + (setq wl-summary-buffer-number-column + (or (wl-get-assoc-list-value wl-summary-number-column-alist + (wl-summary-buffer-folder-name)) + wl-summary-default-number-column)) + (wl-line-formatter-setup + wl-summary-buffer-line-formatter + (or (wl-get-assoc-list-value + wl-folder-summary-line-format-alist + (elmo-folder-name-internal folder)) + wl-summary-line-format) + wl-summary-line-format-spec-alist) (setq wl-summary-buffer-persistent (wl-folder-persistent-p (elmo-folder-name-internal folder))) (elmo-folder-set-persistent-internal folder wl-summary-buffer-persistent) @@ -837,7 +840,6 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." expunged) (fset 'wl-summary-append-message-func-internal (wl-summary-get-append-message-func)) - (wl-summary-buffer-number-column-detect nil) (erase-buffer) (message "Re-scanning...") (setq i 0) @@ -1106,8 +1108,7 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'." (setq wl-summary-buffer-target-mark-list nil) (setq wl-summary-buffer-refile-list nil) (setq wl-summary-buffer-copy-list nil) - (setq wl-summary-buffer-delete-list nil) - (wl-summary-buffer-number-column-detect nil)) + (setq wl-summary-buffer-delete-list nil)) (defun wl-summary-sync (&optional unset-cursor force-range) (interactive) @@ -1299,8 +1300,8 @@ If ARG is non-nil, checking is omitted." "[ " (save-match-data (wl-set-string-width - wl-summary-from-width - (wl-summary-from-func-internal + 17 + (funcall wl-summary-from-function (eword-decode-string (elmo-delete-char ?\" @@ -1434,18 +1435,6 @@ If ARG is non-nil, checking is omitted." (set-buffer-modified-p nil) mark))))) -(defun wl-summary-delete-all-status-marks-on-buffer () - (interactive) - (save-excursion - (goto-char (point-min)) - (let ((inhibit-read-only t) - (buffer-read-only nil) - (case-fold-search nil)) - (while (re-search-forward - (concat "^" wl-summary-buffer-number-regexp ".\\(.\\)") nil t) - (delete-region (match-beginning 1) (match-end 1)) - (insert " "))))) - (defun wl-summary-delete-marks-on-buffer (marks) (while marks (wl-summary-unmark (pop marks)))) @@ -1477,7 +1466,7 @@ If ARG is non-nil, checking is omitted." (let ((inhibit-read-only t) (buffer-read-only nil) (case-fold-search nil) - (regexp (concat "^" wl-summary-buffer-number-regexp "\\([^ ]\\)" ))) + (regexp (concat wl-summary-message-regexp "\\([^ 0-9]\\)" ))) (while (re-search-forward regexp nil t) (delete-region (match-beginning 1) (match-end 1)) (insert " ") @@ -1601,7 +1590,8 @@ If ARG is non-nil, checking is omitted." wl-summary-new-mark))) (save-excursion (goto-char (point-min)) - (while (re-search-forward "^ *\\(-?[0-9]+\\)[^0-9]\\([^0-9 ]\\)" nil t) + (while (re-search-forward "^ *\\(-?[0-9]+\\)[^0-9]\\([^0-9 ]\\)" + nil t) (setq msg (string-to-int (wl-match-buffer 1))) (setq mark (wl-match-buffer 2)) (when (and (not (string= mark wl-summary-important-mark)) @@ -1645,7 +1635,6 @@ If ARG is non-nil, checking is omitted." (number-alist (elmo-msgdb-get-number-alist msgdb)) (case-fold-search nil) mark number unread new-mark) -;;; (re-search-backward "^ *[0-9]+..[0-9]+/[0-9]+" nil t) ; set cursor line (beginning-of-line) (when (looking-at "^ *\\(-?[0-9]+\\)[^0-9]\\([^0-9]\\)") (progn @@ -1766,14 +1755,14 @@ If ARG is non-nil, checking is omitted." (wl-summary-buffer-folder-name) (+ wl-summary-buffer-unread-count wl-summary-buffer-new-count))))) -(defun wl-summary-set-status-marks-on-buffer (before after) - "Set the MARKS marks on buffer." +(defun wl-summary-replace-status-marks (before after) + "Replace the status marks on buffer." (interactive) (save-excursion (goto-char (point-min)) (let ((inhibit-read-only t) (buffer-read-only nil) - (regexp (concat "^" wl-summary-buffer-number-regexp ".\\(\\%s\\)"))) + (regexp (concat wl-summary-message-regexp ".\\(\\%s\\)"))) (while (re-search-forward (format regexp (regexp-quote before)) nil t) (delete-region (match-beginning 1) (match-end 1)) @@ -1929,7 +1918,7 @@ If ARG is non-nil, checking is omitted." (wl-summary-delete-messages-on-buffer delete-list "Deleting...") (message "Deleting...done")) (when new-msgdb - (wl-summary-set-status-marks-on-buffer + (wl-summary-replace-status-marks wl-summary-new-mark wl-summary-unread-uncached-mark)) (setq append-list (elmo-msgdb-get-overview new-msgdb)) @@ -2035,7 +2024,6 @@ If ARG is non-nil, checking is omitted." (+ (car pair) (cdr pair))) (elmo-folder-messages folder))) (wl-summary-update-modeline) - (wl-summary-buffer-number-column-detect t) ;; (unless unset-cursor (goto-char (point-min)) @@ -2265,13 +2253,13 @@ If ARG, without confirm." wl-summary-buffer-target-mark-list wl-summary-buffer-elmo-folder wl-summary-buffer-number-column - wl-summary-buffer-number-regexp wl-summary-buffer-message-modified wl-summary-buffer-mark-modified wl-summary-buffer-thread-modified wl-summary-buffer-number-list wl-summary-buffer-msgdb - wl-summary-buffer-folder-name) + wl-summary-buffer-folder-name + wl-summary-buffer-line-formatter) (and (eq wl-summary-buffer-view 'thread) '(wl-thread-entity-hashtb wl-thread-entities @@ -2423,7 +2411,6 @@ If ARG, without confirm." (wl-summary-update-modeline))) (unless (eq wl-summary-buffer-view 'thread) (wl-summary-make-number-list)) - (wl-summary-buffer-number-column-detect t) (wl-summary-toggle-disp-msg (if wl-summary-buffer-disp-msg 'on 'off)) (unless (and reuse-buf keep-cursor) ;(setq hilit wl-summary-highlight) @@ -2518,6 +2505,11 @@ If ARG, without confirm." (set-buffer-modified-p nil)) retval)) +(defun wl-summary-goto-previous-message-beginning () + (end-of-line) + (re-search-backward wl-summary-message-regexp nil t) + (beginning-of-line)) + (defun wl-summary-goto-top-of-current-thread () (wl-summary-jump-to-msg (wl-thread-entity-get-number @@ -2567,8 +2559,8 @@ If ARG, without confirm." (elmo-replace-in-string subject "^\\[.*\\]" ""))) (defun wl-summary-subject-equal (subject1 subject2) - (string= (wl-summary-subject-filter-func-internal subject1) - (wl-summary-subject-filter-func-internal subject2))) + (string= (funcall wl-summary-subject-filter-function subject1) + (funcall wl-summary-subject-filter-function subject2))) (defmacro wl-summary-put-alike (alike) (` (elmo-set-hash-val (format "#%d" (wl-count-lines)) @@ -2620,11 +2612,11 @@ If ARG, without confirm." overview (function (lambda (x) - (wl-summary-subject-filter-func-internal + (funcall wl-summary-subject-filter-function (elmo-msgdb-overview-entity-get-subject-no-decode x)))) t)) - (setq match (wl-summary-subject-filter-func-internal - (elmo-msgdb-overview-entity-get-subject entity))) + (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)) @@ -2773,9 +2765,7 @@ If ARG, without confirm." (message "No message.") (end-of-line) (setq eol (point)) - (re-search-backward (concat "^" wl-summary-buffer-number-regexp - "..../..")) ; set cursor line - (beginning-of-line))) + (wl-summary-goto-previous-message-beginning))) (if (or (and (not visible) ;; already exists in msgdb. (assq number (elmo-msgdb-get-number-alist msgdb))) @@ -3627,7 +3617,7 @@ If ARG, exit virtual folder." (interactive) (save-excursion (goto-char (point-min)) - (let ((regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) + (let ((regexp (concat wl-summary-message-regexp "\\(\\*\\)")) number mlist) (while (re-search-forward regexp nil t) (let (wl-summary-buffer-disp-msg) @@ -3685,7 +3675,7 @@ If ARG, exit virtual folder." regexp number msgid entity folder mlist) (save-excursion (goto-char (point-min)) - (setq regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) + (setq regexp (concat wl-summary-message-regexp "\\(\\*\\)")) ;; guess by first mark (when (re-search-forward regexp nil t) (setq msgid (cdr (assq (setq number (wl-summary-message-number)) @@ -3754,7 +3744,7 @@ If ARG, exit virtual folder." (interactive) (save-excursion (goto-char (point-min)) - (let ((regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) + (let ((regexp (concat wl-summary-message-regexp "\\(\\*\\)")) (inhibit-read-only t) (buffer-read-only nil) number mlist) @@ -3782,7 +3772,7 @@ If ARG, exit virtual folder." (interactive) (save-excursion (goto-char (point-min)) - (let ((regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) + (let ((regexp (concat wl-summary-message-regexp "\\(\\*\\)")) (inhibit-read-only t) (buffer-read-only nil) number mlist) @@ -3811,7 +3801,7 @@ If ARG, exit virtual folder." (interactive) (save-excursion (goto-char (point-min)) - (let ((regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) + (let ((regexp (concat wl-summary-message-regexp "\\(\\*\\)")) (inhibit-read-only t) (buffer-read-only nil) number mlist) @@ -3843,7 +3833,7 @@ If ARG, exit virtual folder." (let ((wl-save-dir (wl-read-directory-name "Save to directory: " wl-temporary-file-directory)) - (regexp (concat "^" wl-summary-buffer-number-regexp "\\(\\*\\)")) + (regexp (concat wl-summary-message-regexp "\\(\\*\\)")) number mlist) (if (null (file-exists-p wl-save-dir)) (make-directory wl-save-dir)) @@ -3973,9 +3963,7 @@ If ARG, exit virtual folder." (setq visible nil)) (end-of-line) (setq eol (point)) - (re-search-backward (concat "^" wl-summary-buffer-number-regexp - "..../..") nil t)) ; set cursor line - (beginning-of-line)) + (wl-summary-goto-previous-message-beginning))) (if (or (and (not visible) (assq number (elmo-msgdb-get-number-alist msgdb))) (re-search-forward "^ *\\(-?[0-9]+\\)[^0-9]\\([^0-9]\\)" eol t)) @@ -4025,92 +4013,129 @@ If ARG, exit virtual folder." (set-buffer-modified-p nil) number) -(defsubst wl-summary-format-date (date-string) - (condition-case nil - (let ((datevec (timezone-fix-time date-string nil - wl-summary-fix-timezone))) - (format "%02d/%02d(%s)%02d:%02d" - (aref datevec 1) - (aref datevec 2) - (elmo-date-get-week (aref datevec 0) - (aref datevec 1) - (aref datevec 2)) - (aref datevec 3) - (aref datevec 4))) - (error "??/??(??)??:??"))) - -(defun wl-summary-create-line (entity parent temp-mark - &optional - thr-children-number - thr-indent-string - thr-linked) - "Create a summary line." - (let ((wl-mime-charset wl-summary-buffer-mime-charset) - (elmo-mime-charset wl-summary-buffer-mime-charset) - (folder wl-summary-buffer-elmo-folder) - (number (elmo-msgdb-overview-entity-get-number entity)) - (thr-indent-string (or thr-indent-string "")) - no-parent from subject parent-raw-subject parent-subject - line mark - (elmo-lang wl-summary-buffer-weekday-name-lang) - (children-num (if thr-children-number - (int-to-string thr-children-number)))) - (if (string= thr-indent-string "") +;;; Summary line. +(defvar wl-summary-line-formatter nil) + +(defvar wl-datevec) +(defvar wl-thr-indent-string) +(defvar wl-thr-children-number) +(defvar wl-thr-linked) +(defvar wl-message-entity) +(defvar wl-parent-message-entity) + +(defun wl-summary-line-year () + (aref wl-datevec 0)) +(defun wl-summary-line-month () + (format "%02d" (aref wl-datevec 1))) +(defun wl-summary-line-day () + (format "%02d" (aref wl-datevec 2))) +(defun wl-summary-line-day-of-week () + (elmo-date-get-week (aref wl-datevec 0) + (aref wl-datevec 1) + (aref wl-datevec 2))) +(defun wl-summary-line-hour () + (format "%02d" (aref wl-datevec 3))) +(defun wl-summary-line-minute () + (format "%02d" (aref wl-datevec 4))) +(defun wl-summary-line-open-bracket () + (if wl-thr-linked "<" "[")) +(defun wl-summary-line-close-bracket () + (if wl-thr-linked ">" "]")) +(defun wl-summary-line-children-number () + (if wl-thr-children-number + (concat "+" (int-to-string wl-thr-children-number) ":") + "")) +(defun wl-summary-line-thread-indent () + (or wl-thr-indent-string "")) + +(defun wl-summary-line-size () + (let ((size (elmo-msgdb-overview-entity-get-size wl-message-entity))) + (if size + (cond + ((<= 1 (/ size 1048576)) + (format "%.0fM" (/ size 1048576.0))) + ((<= 1 (/ size 1024)) + (format "%.0fK" (/ size 1024.0))) + (t (format "%dB" size))) + ""))) + +(defun wl-summary-line-subject () + (let (no-parent subject parent-raw-subject parent-subject) + (if (string= wl-thr-indent-string "") (setq no-parent t)) ; no parent - (if (and wl-summary-indent-length-limit - (< wl-summary-indent-length-limit - (string-width thr-indent-string))) - (setq thr-indent-string (wl-set-string-width - wl-summary-indent-length-limit - thr-indent-string))) - (setq from - (wl-set-string-width - (if children-num - (- wl-summary-from-width (length children-num) 2) - wl-summary-from-width) - (elmo-delete-char ?\n - (wl-summary-from-func-internal - (elmo-msgdb-overview-entity-get-from entity))))) (setq subject (elmo-delete-char ?\n (or (elmo-msgdb-overview-entity-get-subject - entity) + wl-message-entity) wl-summary-no-subject-message))) (setq parent-raw-subject - (elmo-msgdb-overview-entity-get-subject parent)) + (elmo-msgdb-overview-entity-get-subject wl-parent-message-entity)) (setq parent-subject (if parent-raw-subject (elmo-delete-char ?\n parent-raw-subject))) - (setq line + (setq subject + (if (or no-parent + (null parent-subject) + (not (wl-summary-subject-equal + subject parent-subject))) + (funcall wl-summary-subject-function subject) + "")) + (if (and (not wl-summary-width) + wl-summary-subject-length-limit) + (truncate-string subject + wl-summary-subject-length-limit) + subject))) + +(defun wl-summary-line-from () + (elmo-delete-char ?\n + (funcall wl-summary-from-function + (elmo-msgdb-overview-entity-get-from + wl-message-entity)))) + +(defun wl-summary-line-children-and-from () + (concat + (wl-summary-line-children-number) " " + (wl-summary-line-from))) + +(defun wl-summary-create-line (wl-message-entity + wl-parent-message-entity + temp-mark + &optional + wl-thr-children-number + wl-thr-indent-string + wl-thr-linked) + "Create a summary line." + (let ((wl-mime-charset wl-summary-buffer-mime-charset) + (elmo-mime-charset wl-summary-buffer-mime-charset) + (elmo-lang wl-summary-buffer-weekday-name-lang) + (wl-datevec (timezone-fix-time + (elmo-msgdb-overview-entity-get-date + wl-message-entity) + nil + wl-summary-fix-timezone)) + line mark) + (if (and wl-summary-indent-length-limit + (< wl-summary-indent-length-limit + (string-width wl-thr-indent-string))) + (setq wl-thr-indent-string (wl-set-string-width + wl-summary-indent-length-limit + wl-thr-indent-string))) + (setq line (concat - (format (concat "%" - (int-to-string - wl-summary-buffer-number-column) - "s%s%s%s %s") - number - (or temp-mark " ") - (setq mark (or (elmo-message-mark folder number) " ")) - (wl-summary-format-date - (elmo-msgdb-overview-entity-get-date entity)) - (or thr-indent-string "")) - (format (if thr-linked - "<%s > %s" - "[%s ] %s") - (if children-num - (concat "+" children-num ": " from) - (concat " " from)) - (progn - (setq subject - (if (or no-parent - (null parent-subject) - (not (wl-summary-subject-equal - subject parent-subject))) - (wl-summary-subject-func-internal subject) "")) - (if (and (not wl-summary-width) - wl-summary-subject-length-limit) - (truncate-string subject - wl-summary-subject-length-limit) - subject))))) + (format + (concat "%" + (number-to-string wl-summary-buffer-number-column) + "s%s%s") + (number-to-string + (elmo-msgdb-overview-entity-get-number wl-message-entity)) + (or temp-mark " ") + (setq mark + (or (elmo-msgdb-get-mark + (wl-summary-buffer-msgdb) + (elmo-msgdb-overview-entity-get-number + wl-message-entity)) + " "))) + (funcall wl-summary-buffer-line-formatter))) (if wl-summary-width (setq line (wl-set-string-width (- wl-summary-width 1) line))) @@ -4118,26 +4143,9 @@ If ARG, exit virtual folder." (wl-highlight-summary-line-string line mark temp-mark - thr-indent-string)) + wl-thr-indent-string)) line)) -(defsubst wl-summary-buffer-number-column-detect (update) - (let (end) - (save-excursion - (goto-char (point-min)) - (setq wl-summary-buffer-number-column - (or - (if (and update - (setq end (if (re-search-forward - "^ *-?[0-9]+[^0-9]" nil t) - (point)))) - (- end (progn (beginning-of-line) (point)) 1)) - (wl-get-assoc-list-value wl-summary-number-column-alist - (wl-summary-buffer-folder-name)) - wl-summary-default-number-column)) - (setq wl-summary-buffer-number-regexp - (wl-repeat-string "." wl-summary-buffer-number-column))))) - (defsubst wl-summary-proc-wday (wday-str year month mday) (save-match-data (if (string-match "\\([A-Z][a-z][a-z]\\).*" wday-str) @@ -4867,11 +4875,11 @@ Use function list is `wl-summary-write-current-folder-functions'." goto-next regex-list regex next-entity finfo) (beginning-of-line) (if (elmo-folder-plugged-p wl-summary-buffer-elmo-folder) - (setq regex (format "^%s[^%s]" - wl-summary-buffer-number-regexp + (setq regex (format "%s[^%s]" + wl-summary-message-regexp skip-mark-regexp)) - (setq regex (format "^%s[^%s]\\(%s\\|%s\\| \\)" - wl-summary-buffer-number-regexp + (setq regex (format "%s[^%s]\\(%s\\|%s\\| \\)" + wl-summary-message-regexp skip-mark-regexp (regexp-quote wl-summary-unread-cached-mark) (regexp-quote wl-summary-important-mark)))) @@ -4906,11 +4914,11 @@ Use function list is `wl-summary-write-current-folder-functions'." goto-next regex regex-list next-entity finfo) (end-of-line) (if (elmo-folder-plugged-p wl-summary-buffer-elmo-folder) - (setq regex (format "^%s[^%s]" - wl-summary-buffer-number-regexp + (setq regex (format "%s[^%s]" + wl-summary-message-regexp skip-mark-regexp)) - (setq regex (format "^%s[^%s]\\(%s\\|%s\\| \\)" - wl-summary-buffer-number-regexp + (setq regex (format "%s[^%s]\\(%s\\|%s\\| \\)" + wl-summary-message-regexp skip-mark-regexp (regexp-quote wl-summary-unread-cached-mark) (regexp-quote wl-summary-important-mark)))) diff --git a/wl/wl-thread.el b/wl/wl-thread.el index 7cdd0a0..746bfba 100644 --- a/wl/wl-thread.el +++ b/wl/wl-thread.el @@ -720,48 +720,7 @@ Message is inserted to the summary buffer." (defun wl-thread-update-children-number (entity) "Update the children number." - (save-excursion - (wl-summary-jump-to-msg (wl-thread-entity-get-number entity)) - (beginning-of-line) - (let ((text-prop (get-text-property (point) 'face)) - from from-end beg str) - (cond - ((looking-at (concat "^" wl-summary-buffer-number-regexp - "..../..\(.*\)..:.. [" - wl-thread-indent-regexp - "]*[[<]\\+\\([0-9]+\\):")) - (delete-region (match-beginning 1)(match-end 1)) - (goto-char (match-beginning 1)) - (setq str (format "%s" (wl-thread-entity-get-children-num entity))) - (if wl-summary-highlight - (put-text-property 0 (length str) 'face text-prop str)) - (insert str)) - ((looking-at (concat "^" wl-summary-buffer-number-regexp - "..../..\(.*\)..:.. [" - wl-thread-indent-regexp - "]*[[<]")) - (goto-char (match-end 0)) - (setq beg (current-column)) - (setq from-end (save-excursion - (move-to-column (+ 1 beg wl-summary-from-width)) - (point))) - (setq from (buffer-substring (match-end 0) from-end)) - (delete-region (match-end 0) from-end) - (setq str (wl-set-string-width - (1+ wl-summary-from-width) - (format - "+%s:%s" - (wl-thread-entity-get-children-num - entity) - from))) - (if wl-summary-highlight - (put-text-property 0 (length str) 'face text-prop str)) - (insert str) - (condition-case nil ; it's dangerous, so ignore error. - (run-hooks 'wl-thread-update-children-number-hook) - (error - (ding) - (message "Error in wl-thread-update-children-number-hook.")))))))) + (wl-thread-update-line-on-buffer (wl-thread-entity-get-number entity))) ;; ;; Thread oriented commands. @@ -1143,7 +1102,8 @@ Message is inserted to the summary buffer." (save-excursion (goto-char beg) (while (< (point) end) - (wl-thread-update-indent-string) + ;(wl-thread-update-indent-string) + (wl-thread-update-line-on-buffer) (forward-line 1)))) (defsubst wl-thread-make-indent-string (entity) @@ -1174,34 +1134,6 @@ Message is inserted to the summary buffer." (setq cur (wl-thread-entity-get-parent-entity cur)))) ret-val)) -(defun wl-thread-update-indent-string () - "Update indent string of current line." - (interactive) - (save-excursion - (beginning-of-line) - (let ((inhibit-read-only t) - (buffer-read-only nil) - thr-str) - (when (looking-at (concat "^ *\\([0-9]+\\)" - "..../..\(.*\)..:.. \\(" - wl-highlight-thread-indent-string-regexp - "\\)[[<]")) - (goto-char (match-beginning 2)) - (delete-region (match-beginning 2) - (match-end 2)) - (setq thr-str - (wl-thread-make-indent-string - (wl-thread-get-entity (string-to-int (wl-match-buffer 1))))) - (if (and wl-summary-indent-length-limit - (< wl-summary-indent-length-limit - (string-width thr-str))) - (setq thr-str (wl-set-string-width - wl-summary-indent-length-limit - thr-str))) - (insert thr-str) - (if wl-summary-highlight - (wl-highlight-summary-current-line)))))) - (defun wl-thread-set-parent (&optional parent-number) "Set current message's parent interactively." (interactive) diff --git a/wl/wl-util.el b/wl/wl-util.el index 1336a9d..36a913b 100644 --- a/wl/wl-util.el +++ b/wl/wl-util.el @@ -32,7 +32,7 @@ ;;; Code: ;; - +(require 'bytecomp) (eval-when-compile (require 'elmo-util)) @@ -915,6 +915,43 @@ is enclosed by at least one regexp grouping construct." (apply (function concat) (nreverse expanded)) newtext))) +(defun wl-line-parse-format (format spec-alist) + "Make a formatter from FORMAT and SPEC-ALIST." + (let (f spec specs) + (setq f + (with-temp-buffer + (insert format) + (goto-char (point-min)) + (while (search-forward "%" nil t) + (cond + ((looking-at "%") + (goto-char (match-end 0))) + ((looking-at "\\([0-9]*\\)\\([^0-9]\\)") + (setq spec + (if (setq spec (assq (string-to-char (match-string 2)) + spec-alist)) + (nth 1 spec) + (match-string 2))) + (unless (string= "" (match-string 1)) + (setq spec (list 'wl-set-string-width + (string-to-number (match-string 1)) + spec))) + (setq specs (cons spec specs)) + (replace-match "s" 'fixed)))) + (buffer-string))) + (append (list 'format f) (nreverse specs)))) + +(defmacro wl-line-formatter-setup (formatter format alist) + (` (let (byte-compile-warnings) + (setq (, formatter) + (byte-compile + (list 'lambda () + (wl-line-parse-format (, format) (, alist))))) + (when (get-buffer "*Compile-Log*") + (bury-buffer "*Compile-Log*")) + (when (get-buffer "*Compile-Log-Show*") + (bury-buffer "*Compile-Log-Show*"))))) + (require 'product) (product-provide (provide 'wl-util) (require 'wl-version)) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 12e01a1..a0b9089 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -174,6 +174,61 @@ If you don't have multiple e-mail addresses, you don't have to set this." string) :group 'wl) +(defvar wl-summary-line-format-spec-alist + '((?Y (wl-summary-line-year)) + (?M (wl-summary-line-month)) + (?D (wl-summary-line-day)) + (?W (wl-summary-line-day-of-week)) + (?h (wl-summary-line-hour)) + (?m (wl-summary-line-minute)) + (?\[ (wl-summary-line-open-bracket)) + (?\] (wl-summary-line-close-bracket)) + (?t (wl-summary-line-thread-indent)) + (?s (wl-summary-line-subject)) + (?S (wl-summary-line-size)) + (?c (wl-summary-line-children-number)) + (?f (wl-summary-line-from)) + (?F (wl-summary-line-children-and-from))) + "An alist of format specifications that can appear in summary lines. +Each element is a list of following: +\(SPEC STRING-EXP\) +SPEC is a character for format specification. +STRING is an expression to get string to insert.") + +(defcustom wl-summary-line-format "%M/%D(%W)%h:%m %t%[%17F %] %s" + "*A default format string for summary line of Wanderlust. +It may include any of the following format specifications +which are replaced by the given information: + +%Y The year of the date field of the message (zero padded). +%M The month of the date field of the message (zero padded). +%D The day of the date field of the message (zero padded). +%W The weekday name of the date field of the message (zero padded). +%h The hour of the date field of the message (zero padded). +%m The minute of the date field of the message (zero padded). +%[ An open bracket. If the message thread is linked, + it is replaced with '<'. +%] A close bracket. If the message thread is linked, + it is replaced with '>'. +%c The children number of the closed message thread. +%f The from: field string of the message. +%F The children number of the closed message thread and + the from: field string of the message are concatenated. +%s The subject: field string of the message. +%S the size of the message (if available)." + :group 'wl-summary + :type 'string) + +(defcustom wl-folder-summary-line-format-alist nil + "An alist of folder name and a summary line format. +If no match, `wl-summary-line-format' is used. +e.x. + '((\"^%\" . \"%M/%D(%W)%h:%m %t%[%14F %](%S) %s\") + (\"^@2ch\" . \"%M%/%D/%h:%m %t[%9F ]%s\")))" + :type '(repeat (cons (regexp :tag "Folder Regexp") + (string :tag "line format"))) + :group 'wl-summary) + (defcustom wl-summary-from-function 'wl-summary-default-from "*A function for displaying sender (From: field) information." :type 'function @@ -1401,12 +1456,6 @@ with wl-highlight-folder-many-face." (string :tag "Other")) :group 'wl-summary) -(defcustom wl-summary-from-width 17 - "*From width in summary." - :type 'integer - :group 'wl-summary - :group 'wl-pref) - (defcustom wl-summary-subject-length-limit nil "*Set subject width in summary when wl-summary-width is nil. Nil means unlimited" @@ -2424,8 +2473,6 @@ a symbol `bitmap', `xbm' or `xpm' in order to force the image format." 'wl-temporary-file-directory) ;; 2001-12-07 -(elmo-define-obsolete-variable 'wl-from-width - 'wl-summary-from-width) (elmo-define-obsolete-variable 'wl-subject-length-limit 'wl-summary-subject-length-limit) -- 1.7.10.4