From d309a65d99f115e005ebaf628ea854c4c76838a5 Mon Sep 17 00:00:00 2001 From: teranisi Date: Sun, 12 Sep 2004 08:42:04 +0000 Subject: [PATCH] * wl-vars.el (wl-draft-forward-hook): Setup to put forwarded flag. (wl-summary-persistent-mark-priority-list): Add `forwarded'. (wl-summary-uncached-mark): Renamed from wl-summary-read-uncached-mark. (wl-summary-new-cached-mark): Changed default value to 'n'. (wl-summary-unread-cached-mark): Changed default value to 'u'. (wl-summary-answered-cached-mark): Changed default value to 'a'. (wl-folder-sync-range-alist): Remove spec for 'flag. (wl-summary-force-prefetch-folder-list): New user option. * wl-summary.el (wl-summary-mode-map): Bind 'M-k' to `wl-summary-toggle-persistent-mark'. (wl-summary-update-mark-and-highlight-window): Don't highlight when number is nil. (wl-summary-mark-as-answered-region): Set interactive argument of `wl-summary-set-persistent-mark-internal'. (wl-summary-mark-as-important-region): Ditto. (wl-summary-unset-persistent-mark): Ditto. (wl-summary-set-persistent-mark): Ditto. (wl-summary-mark-as-answered): Ditto. (wl-summary-mark-as-important): Ditto. (wl-summary-set-persistent-mark-internal): Do nothing when `elmo-message-flag-available-p' is nil. (wl-summary-toggle-persistent-mark): New function. (wl-summary-goto-folder-subr): Call `wl-summary-force-prefetch' when the folder matches `wl-summary-force-prefetch-folder-list'. * wl-highlight.el (wl-highlight-summary-current-line): Do nothing when number is nil. (wl-highlight-summary-forwarded-face): New face. --- wl/ChangeLog | 33 +++++++++++++++++ wl/wl-highlight.el | 72 ++++++++++++++++++++++--------------- wl/wl-summary.el | 100 ++++++++++++++++++++++++++++++++++++---------------- wl/wl-vars.el | 31 ++++++++++------ 4 files changed, 167 insertions(+), 69 deletions(-) diff --git a/wl/ChangeLog b/wl/ChangeLog index cc0dfa8..b595937 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,38 @@ 2004-09-12 Yuuichi Teranishi + * wl-vars.el (wl-draft-forward-hook): Setup to put forwarded flag. + (wl-summary-persistent-mark-priority-list): Add `forwarded'. + (wl-summary-uncached-mark): Renamed from wl-summary-read-uncached-mark. + (wl-summary-new-cached-mark): Changed default value to 'n'. + (wl-summary-unread-cached-mark): Changed default value to 'u'. + (wl-summary-answered-cached-mark): Changed default value to 'a'. + (wl-folder-sync-range-alist): Remove spec for 'flag. + (wl-summary-force-prefetch-folder-list): New user option. + + * wl-summary.el (wl-summary-mode-map): Bind 'M-k' to + `wl-summary-toggle-persistent-mark'. + (wl-summary-update-mark-and-highlight-window): Don't highlight when + number is nil. + (wl-summary-mark-as-answered-region): Set interactive argument of + `wl-summary-set-persistent-mark-internal'. + (wl-summary-mark-as-important-region): Ditto. + (wl-summary-unset-persistent-mark): Ditto. + (wl-summary-set-persistent-mark): Ditto. + (wl-summary-mark-as-answered): Ditto. + (wl-summary-mark-as-important): Ditto. + (wl-summary-set-persistent-mark-internal): Do nothing + when `elmo-message-flag-available-p' is nil. + (wl-summary-toggle-persistent-mark): New function. + (wl-summary-goto-folder-subr): Call `wl-summary-force-prefetch' + when the folder matches `wl-summary-force-prefetch-folder-list'. + + + * wl-highlight.el (wl-highlight-summary-current-line): Do nothing + when number is nil. + (wl-highlight-summary-forwarded-face): New face. + +2004-09-12 Yuuichi Teranishi + * Version number is increased to 2.11.31. 2004-09-11 Yoichi NAKAYAMA diff --git a/wl/wl-highlight.el b/wl/wl-highlight.el index d35420b..da9c23c 100644 --- a/wl/wl-highlight.el +++ b/wl/wl-highlight.el @@ -340,6 +340,21 @@ :group 'wl-summary-faces :group 'wl-faces) +;; forwarded +(wl-defface wl-highlight-summary-forwarded-face + '((((type tty) + (background dark)) + (:foreground "yellow")) + (((class color) + (background dark)) + (:foreground "DarkOliveGreen2")) + (((class color) + (background light)) + (:foreground "DarkOliveGreen4"))) + "Face used for displaying forwarded messages." + :group 'wl-summary-faces + :group 'wl-faces) + (wl-defface wl-summary-persistent-mark-face '((((type tty)) (:foreground "blue")) @@ -916,34 +931,35 @@ (deactivate-mark nil) (number (or number (wl-summary-message-number))) bol eol spec) - (end-of-line) - (setq eol (point)) - (beginning-of-line) - (setq bol (point)) - (setq spec (wl-highlight-summary-line-face-spec - (or flags - (elmo-message-flags wl-summary-buffer-elmo-folder - number)) - (wl-summary-temp-mark number) - (wl-thread-entity-get-parent-entity - (wl-thread-get-entity number)))) - (when (car spec) - (put-text-property bol eol 'face (car spec))) - (when (cdr spec) - (put-text-property (next-single-property-change - (next-single-property-change - bol 'wl-summary-action-argument - nil eol) - 'wl-summary-action-argument nil eol) - eol - 'face - 'wl-highlight-action-argument-face)) - (when wl-use-highlight-mouse-line - (put-text-property bol eol 'mouse-face 'highlight)) - (when wl-highlight-summary-line-help-echo-alist - (wl-highlight-summary-line-help-echo number bol eol)) - (when wl-use-dnd - (wl-dnd-set-drag-starter bol eol))))) + (when number + (end-of-line) + (setq eol (point)) + (beginning-of-line) + (setq bol (point)) + (setq spec (wl-highlight-summary-line-face-spec + (or flags + (elmo-message-flags wl-summary-buffer-elmo-folder + number)) + (wl-summary-temp-mark number) + (wl-thread-entity-get-parent-entity + (wl-thread-get-entity number)))) + (when (car spec) + (put-text-property bol eol 'face (car spec))) + (when (cdr spec) + (put-text-property (next-single-property-change + (next-single-property-change + bol 'wl-summary-action-argument + nil eol) + 'wl-summary-action-argument nil eol) + eol + 'face + 'wl-highlight-action-argument-face)) + (when wl-use-highlight-mouse-line + (put-text-property bol eol 'mouse-face 'highlight)) + (when wl-highlight-summary-line-help-echo-alist + (wl-highlight-summary-line-help-echo number bol eol)) + (when wl-use-dnd + (wl-dnd-set-drag-starter bol eol)))))) (defun wl-highlight-folder (start end) "Highlight folder between start and end. diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 470bc49..23865ab 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -417,6 +417,7 @@ See also variable `wl-use-petname'." (define-key wl-summary-mode-map "f" 'wl-summary-forward) (define-key wl-summary-mode-map "$" 'wl-summary-mark-as-important) (define-key wl-summary-mode-map "F" 'wl-summary-set-flags) + (define-key wl-summary-mode-map "\M-k" 'wl-summary-toggle-persistent-mark) (define-key wl-summary-mode-map "&" 'wl-summary-mark-as-answered) (define-key wl-summary-mode-map "@" 'wl-summary-edit-addresses) @@ -592,9 +593,10 @@ See also variable `wl-use-petname'." (goto-char beg) (while (and (< (point) end) (not (eobp))) (when (null (get-text-property (point) 'face)) - (setq number (wl-summary-message-number) - flags (elmo-message-flags wl-summary-buffer-elmo-folder - number)) + (setq number (wl-summary-message-number)) + (when number + (setq flags (elmo-message-flags wl-summary-buffer-elmo-folder + number))) (let (wl-summary-highlight) (wl-summary-update-persistent-mark number flags)) (wl-highlight-summary-current-line number flags)) @@ -1626,7 +1628,8 @@ If ARG is non-nil, checking is omitted." (if (null number-list) (message "No message.") (wl-summary-set-persistent-mark-internal remove 'answered - number-list) + number-list + nil nil (interactive-p)) (wl-summary-count-unread) (wl-summary-update-modeline)))) @@ -1641,7 +1644,8 @@ If ARG is non-nil, checking is omitted." 'important)))) (if (null number-list) (message "No message.") - (wl-summary-set-persistent-mark-internal remove 'important number-list) + (wl-summary-set-persistent-mark-internal remove 'important number-list + nil nil (interactive-p)) (wl-summary-count-unread) (wl-summary-update-modeline)))) @@ -2438,6 +2442,11 @@ If ARG, without confirm." (when (and wl-summary-buffer-window-scroll-functions wl-on-xemacs) (sit-for 0)) + (when (or (eq t wl-summary-force-prefetch-folder-list) + (wl-string-match-member + (elmo-folder-name-internal wl-summary-buffer-elmo-folder) + wl-summary-force-prefetch-folder-list)) + (wl-summary-force-prefetch)) (unwind-protect (run-hooks 'wl-summary-prepared-hook) (set-buffer-modified-p nil)) @@ -2827,7 +2836,8 @@ The mark is decided according to the FOLDER, FLAGS and CACHED." "wl-summary-%s-cached-mark" (car priorities)) (format "wl-summary-%s-uncached-mark" (car priorities)))))) - (if (boundp var) + (if (and (boundp var) + (symbol-value var)) (symbol-value var) (if cached (downcase (substring (symbol-name (car priorities)) @@ -2838,7 +2848,7 @@ The mark is decided according to the FOLDER, FLAGS and CACHED." (or mark (if (or cached (elmo-folder-local-p folder)) nil - wl-summary-read-uncached-mark)))) + wl-summary-uncached-mark)))) (defsubst wl-summary-message-mark (folder number &optional flags) "Return mark of the message." @@ -3046,10 +3056,11 @@ Return non-nil if the mark is updated" no-modeline-update)) (defsubst wl-summary-set-persistent-mark-internal (inverse - &optional flag - number-or-numbers + flag + &optional number-or-numbers no-modeline-update - no-server) + no-server + interactive) "Set persistent mark." (save-excursion (let ((folder wl-summary-buffer-elmo-folder) @@ -3064,22 +3075,26 @@ Return non-nil if the mark is updated" (list number)))) (if (null number-list) (message "No message.") - (if inverse - (elmo-folder-unset-flag folder number-list flag no-server) - (elmo-folder-set-flag folder number-list flag no-server)) - (dolist (number number-list) - (setq visible (wl-summary-jump-to-msg number)) - ;; set mark on buffer - (when visible - (wl-summary-update-persistent-mark))) - (unless no-modeline-update - ;; Update unread numbers. - ;; should elmo-flag-mark-as-read return unread numbers? - (wl-summary-count-unread) - (wl-summary-update-modeline) - (wl-folder-update-unread - (wl-summary-buffer-folder-name) - wl-summary-buffer-unread-count)))))) + ;; XXX Only the first element of the list is checked. + (if (elmo-message-flag-available-p folder (car number-list) flag) + (progn + (if inverse + (elmo-folder-unset-flag folder number-list flag no-server) + (elmo-folder-set-flag folder number-list flag no-server)) + (dolist (number number-list) + ;; set mark on buffer + (when (wl-summary-jump-to-msg number) + (wl-summary-update-persistent-mark))) + (unless no-modeline-update + ;; Update unread numbers. + ;; should elmo-flag-mark-as-read return unread numbers? + (wl-summary-count-unread) + (wl-summary-update-modeline) + (wl-folder-update-unread + (wl-summary-buffer-folder-name) + wl-summary-buffer-unread-count))) + (if interactive + (error "Flag `%s' is not available in this folder" flag))))))) (defun wl-summary-unset-persistent-mark (&optional flag number-or-numbers @@ -3101,7 +3116,8 @@ Return non-nil if the mark is updated" flag number-or-numbers no-modeline-update - no-server)) + no-server + (interactive-p))) (defun wl-summary-set-persistent-mark (&optional flag number-or-numbers @@ -3123,7 +3139,28 @@ Return non-nil if the mark is updated" flag number-or-numbers no-modeline-update - no-server)) + no-server + (interactive-p))) + +(defun wl-summary-toggle-persistent-mark (&optional force) + "Toggle persistent mark." + (interactive "P") + (let ((completion-ignore-case t) + flag) + (setq flag (intern (downcase + (completing-read + "Flag: " + (mapcar (lambda (flag) + (list (capitalize (symbol-name flag)))) + (wl-summary-get-available-flags)) + nil + 'require-match)))) + (if (and (elmo-message-flagged-p wl-summary-buffer-elmo-folder + (wl-summary-message-number) + flag) + (not force)) + (wl-summary-unset-persistent-mark flag) + (wl-summary-set-persistent-mark flag)))) (defun wl-summary-mark-as-answered (&optional number-or-numbers no-modeline-update) @@ -3135,7 +3172,9 @@ Return non-nil if the mark is updated" 'answered)) 'answered number-or-numbers - no-modeline-update)) + no-modeline-update + nil + (interactive-p))) (defun wl-summary-mark-as-unanswered (&optional number-or-numbers no-modeline-update) @@ -3222,7 +3261,8 @@ Return non-nil if the mark is updated" (elmo-message-flagged-p wl-summary-buffer-elmo-folder (wl-summary-message-number) 'important)) - 'important))) + 'important + nil nil nil (interactive-p)))) ;;; Summary line. (defvar wl-summary-line-formatter nil) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 29a9051..58ab75d 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -759,7 +759,8 @@ reasons of system internal to accord facilities for the Emacs variants.") "A hook called when replied. This hook runs on the draft buffer.") -(defvar wl-draft-forward-hook nil +(defvar wl-draft-forward-hook + '((lambda () (wl-draft-setup-parent-flag 'forwarded))) "A hook called when forwarded. This hook runs on the draft buffer.") @@ -1019,6 +1020,7 @@ cdr of each cons cell is used for preparing headers of draft message." (defcustom wl-summary-persistent-mark-priority-list '(flag new answered + forwarded unread) "List of preserved flag symbols to define the priority to map\ to the persistent mark. @@ -1042,12 +1044,17 @@ Example: (const :tag "Default mark" nil)))) :group 'wl-summary) +(defcustom wl-summary-uncached-mark "!" + "Mark for uncached message with no flag." + :type '(string :tag "Mark") + :group 'wl-summary-marks) + (defcustom wl-summary-new-uncached-mark "N" "Mark for new and uncached message." :type '(string :tag "Mark") :group 'wl-summary-marks) -(defcustom wl-summary-new-cached-mark "?" +(defcustom wl-summary-new-cached-mark "n" "Mark for new but already cached message." :type '(string :tag "Mark") :group 'wl-summary-marks) @@ -1057,17 +1064,12 @@ Example: :type '(string :tag "Mark") :group 'wl-summary-marks) -(defcustom wl-summary-unread-cached-mark "!" +(defcustom wl-summary-unread-cached-mark "u" "Mark for unread but already cached message." :type '(string :tag "Mark") :group 'wl-summary-marks) -(defcustom wl-summary-read-uncached-mark "u" - "Mark for read but uncached message." - :type '(string :tag "Mark") - :group 'wl-summary-marks) - -(defcustom wl-summary-answered-cached-mark "&" +(defcustom wl-summary-answered-cached-mark "a" "Mark for answered and cached message." :type '(string :tag "Mark") :group 'wl-summary-marks) @@ -2244,6 +2246,14 @@ Each elements are regexp of folder name." (repeat (regexp :tag "Folder Regexp"))) :group 'wl-pref) +(defcustom wl-summary-force-prefetch-folder-list nil + "All folders that match this list are prefetched. +Each elements are regexp of folder name." + :type '(radio (const :tag "none" nil) + (const :tag "all" t) + (repeat (regexp :tag "Folder Regexp"))) + :group 'wl-pref) + (defcustom wl-no-save-folder-list '("^/.*$" "^\\[.*$") "All folders that match this list won't save its msgdb. Each elements are regexp of folder name." @@ -2311,8 +2321,7 @@ e.x. :group 'wl-pref) (defcustom wl-folder-sync-range-alist - (list (cons 'wl-require-update-all-folder-p "all") - (cons "^'flag" "all")) + (list (cons 'wl-require-update-all-folder-p "all")) "*Default sync range alist. If no matches, `wl-default-sync-range' is used." :type '(repeat (cons (choice (regexp :tag "Folder Regexp") (symbol :tag "A function")) -- 1.7.10.4