* wl-vars.el (wl-summary-mark-action-list): Moved from wl-summary.el
authorteranisi <teranisi>
Mon, 14 Jul 2003 15:01:56 +0000 (15:01 +0000)
committerteranisi <teranisi>
Mon, 14 Jul 2003 15:01:56 +0000 (15:01 +0000)
and define using defcustom;
Define 4th element as a face.

* wl-summary.el (wl-summary-incorporate): Use
`wl-summary-prefetch-region-no-mark' instead of
`wl-summary-prefetch-region'.
(wl-summary-prefetch-region-no-mark): Revival of old
`wl-summary-prefetch-region'.
(wl-summary-mark-action-list): Moved to wl-vars.el

* wl-highlight.el (wl-highlight-summary-current-line): Decide
face according to the `wl-summary-mark-action-list'.
(wl-highlight-summary-current-line): Ditto;
Removed destination highlighting.

wl/ChangeLog
wl/wl-highlight.el
wl/wl-summary.el
wl/wl-vars.el

index 6ca4cf5..80cf611 100644 (file)
@@ -1,5 +1,21 @@
 2003-07-14  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * wl-vars.el (wl-summary-mark-action-list): Moved from wl-summary.el
+       and define using defcustom;
+       Define 4th element as a face.
+       
+       * wl-summary.el (wl-summary-incorporate): Use 
+       `wl-summary-prefetch-region-no-mark' instead of
+       `wl-summary-prefetch-region'.
+       (wl-summary-prefetch-region-no-mark): Revival of old
+       `wl-summary-prefetch-region'.
+       (wl-summary-mark-action-list): Moved to wl-vars.el
+
+       * wl-highlight.el (wl-highlight-summary-current-line): Decide
+       face according to the `wl-summary-mark-action-list'.
+       (wl-highlight-summary-current-line): Ditto;
+       Removed destination highlighting.
+
        * wl-highlight.el (wl-highlight-summary-prefetch-face): New face.
        (wl-highlight-summary-line-string): Highlight for "i" mark.
        (wl-highlight-summary-current-line): Ditto.
index 2160db1..94fcee6 100644 (file)
        (put-text-property bol eol 'face text-face)))))
 
 (defun wl-highlight-summary-line-string (line mark temp-mark indent)
-  (let (fsymbol)
+  (let (fsymbol action)
     (cond ((and (string= temp-mark wl-summary-score-over-mark)
                (member mark (list elmo-msgdb-unread-cached-mark
                                   elmo-msgdb-unread-uncached-mark
                                   elmo-msgdb-unread-uncached-mark
                                   elmo-msgdb-new-mark)))
           (setq fsymbol 'wl-highlight-summary-low-unread-face))
-         ((string= temp-mark "o")
-          (setq fsymbol 'wl-highlight-summary-refiled-face))
-         ((string= temp-mark "O")
-          (setq fsymbol 'wl-highlight-summary-copied-face))
-         ((string= temp-mark "d")
-          (setq fsymbol 'wl-highlight-summary-deleted-face))
-         ((string= temp-mark "D")
-          (setq fsymbol 'wl-highlight-summary-erased-face))
-         ((string= temp-mark "i")
-          (setq fsymbol 'wl-highlight-summary-prefetch-face))
-         ((string= temp-mark "*")
-          (setq fsymbol 'wl-highlight-summary-temp-face))
+         ((setq action (assoc temp-mark wl-summary-mark-action-list))
+          (setq fsymbol (nth 4 action)))
          ((string= mark elmo-msgdb-new-mark)
           (setq fsymbol 'wl-highlight-summary-new-face))
          ((member mark (list elmo-msgdb-unread-cached-mark
     (let ((inhibit-read-only t)
          (case-fold-search nil) temp-mark status-mark
          (deactivate-mark nil)
-         fsymbol bol eol matched thread-top looked-at dest ds)
+         fsymbol action bol eol matched thread-top looked-at dest ds)
       (end-of-line)
       (setq eol (point))
       (beginning-of-line)
       (setq bol (point))
       (setq status-mark (wl-summary-persistent-mark))
       (setq temp-mark (wl-summary-temp-mark))
-      (cond
-       ((string= temp-mark "*")
-       (setq fsymbol 'wl-highlight-summary-temp-face))
-       ((string= temp-mark "d")
-       (setq fsymbol 'wl-highlight-summary-deleted-face))
-       ((string= temp-mark "D")
-       (setq fsymbol 'wl-highlight-summary-erased-face))
-       ((string= temp-mark "i")
-       (setq fsymbol 'wl-highlight-summary-prefetch-face))
-       ((string= temp-mark "O")
-       (setq fsymbol 'wl-highlight-summary-copied-face
-             dest t))
-       ((string= temp-mark "o")
-       (setq fsymbol 'wl-highlight-summary-refiled-face
-             dest t)))
+      (when (setq action (assoc temp-mark wl-summary-mark-action-list))
+       (setq fsymbol (nth 4 action)))
       (if (not fsymbol)
          (cond
           ((and (string= temp-mark wl-summary-score-over-mark)
                  (setq fsymbol 'wl-highlight-summary-thread-top-face)
                (setq fsymbol 'wl-highlight-summary-normal-face)))))
       (put-text-property bol eol 'face fsymbol)
-      (when dest
-       (put-text-property (next-single-property-change
-                           (next-single-property-change
-                            bol 'wl-summary-destination
-                            nil eol)
-                           'wl-summary-destination nil eol)
-                          eol
-                          'face
-                          'wl-highlight-refile-destination-face))
       (if wl-use-highlight-mouse-line
          (put-text-property bol
-;;; Use bol instead of (1- (match-end 0))
-;;;                         (1- (match-end 0))
                             eol 'mouse-face 'highlight))
-;;;   (put-text-property (match-beginning 3) (match-end 3)
-;;;                     'face 'wl-highlight-thread-indent-face)
-      ;; Dnd stuff.
       (if wl-use-dnd
          (wl-dnd-set-drag-starter bol eol)))))
 
index b90cb07..2520881 100644 (file)
@@ -1347,8 +1347,8 @@ If ARG is non-nil, checking is omitted."
   (unless arg
     (save-excursion
       (wl-summary-sync-force-update)))
-  (wl-summary-prefetch-region (point-min) (point-max)
-                             wl-summary-incorporate-marks))
+  (wl-summary-prefetch-region-no-mark (point-min) (point-max)
+                                     wl-summary-incorporate-marks))
 
 (defun wl-summary-prefetch-msg (number &optional arg)
   "Returns status-mark. if skipped, returns nil."
@@ -1418,6 +1418,68 @@ If ARG is non-nil, checking is omitted."
                          wl-summary-buffer-new-count))))
                  new-mark)))))))
 
+(defun wl-summary-prefetch-region-no-mark (beg end &optional prefetch-marks)
+  (interactive "r")
+  (let ((count 0)
+       targets
+       mark length
+       entity msg
+       start-pos pos)
+    (save-excursion
+      (setq start-pos (point))
+      (save-restriction
+       (narrow-to-region beg end)
+       ;; collect prefetch targets.
+       (message "Collecting marks...")
+       (goto-char (point-min))
+       (while (not (eobp))
+         (setq mark (wl-summary-persistent-mark)
+               msg (wl-summary-message-number))
+         (if (or (and (null prefetch-marks)
+                      msg
+                      (null (elmo-file-cache-exists-p
+                             (elmo-message-field
+                              wl-summary-buffer-elmo-folder
+                              msg
+                              'message-id))))
+                 (member mark prefetch-marks))
+             (setq targets (nconc targets (list msg))))
+         (setq entity (wl-thread-get-entity msg))
+         (if (or (not (eq wl-summary-buffer-view 'thread))
+                 (wl-thread-entity-get-opened entity))
+             (); opened. no hidden children.
+           (setq targets (nconc
+                          targets
+                          (wl-thread-get-children-msgs-uncached
+                           msg prefetch-marks))))
+         (forward-line 1))
+       (setq length (length targets))
+       (message "Prefetching...")
+       (while targets
+         (setq mark (if (not (wl-thread-entity-parent-invisible-p
+                              (wl-thread-get-entity (car targets))))
+                        (progn
+                          (wl-summary-jump-to-msg (car targets))
+                          (wl-summary-prefetch))
+                      (wl-summary-prefetch-msg (car targets))))
+         (if (if prefetch-marks
+                 (string= mark elmo-msgdb-unread-cached-mark)
+               (or (string= mark elmo-msgdb-unread-cached-mark)
+                   (string= mark " ")))
+             (message "Prefetching... %d/%d message(s)"
+                      (setq count (+ 1 count)) length))
+         ;; redisplay!
+         (save-excursion
+           (setq pos (point))
+           (goto-char start-pos)
+           (if (pos-visible-in-window-p pos)
+               (save-restriction
+                 (widen)
+                 (sit-for 0))))
+         (setq targets (cdr targets)))
+       (message "Prefetched %d/%d message(s)" count length)
+       (cons count length)))))
+
 (defun wl-summary-prefetch-region (beg end)
   (interactive "r")
   (wl-summary-mark-region-subr 'wl-summary-prefetch beg end))
@@ -2666,48 +2728,6 @@ If ARG, without confirm."
          (wl-thread-make-indent-string thr-entity)
          (wl-thread-entity-get-linked thr-entity)))))))
 
-;;; Mark & Action
-(defvar wl-summary-mark-action-list
-  '(("*"
-     wl-summary-set-target-mark
-     wl-summary-unset-target-mark
-     nil)
-    ("d"
-     wl-summary-set-action-generic
-     wl-summary-unset-action-generic
-     wl-summary-exec-action-delete)
-    ("D"
-     wl-summary-set-action-generic
-     wl-summary-unset-action-generic
-     wl-summary-exec-action-erase)
-    ("o"
-     wl-summary-set-action-refile
-     wl-summary-unset-action-refile
-     wl-summary-exec-action-refile)
-    ("O"
-     wl-summary-set-action-copy
-     wl-summary-unset-action-copy
-     wl-summary-exec-action-copy)
-    ("i"
-     wl-summary-set-action-generic
-     wl-summary-unset-action-generic
-     wl-summary-exec-action-prefetch)
-    ;; Action can be added here.
-    )
-  "A variable to define Mark & Action.
-Each element of the list should be a list of
-\(MARK SET-MARK-FUNCTION UNSET-MARK-FUNCTION EXEC-FUNCTION)
-MARK is a temporal mark string to define.
-SET-MARK-FUNCTION is a function called to set the mark.
-Its argument is (MARK NUMBER VISIBLE INTERACTIVE DATA).
-UNSET-MARK-FUNCTION is a function called to unset the mark.
-Its argument is (NUMBER).
-EXEC-FUNCTION is a function called to execute the action.
-Its argument is a list of MARK-INFO.
-MARK-INFO is a list of (NUMBER MARK DATA).
-DATA is the value which is specified by SET-MARK-FUNCTION."
-  )
-
 ;; Set mark
 (defun wl-summary-set-mark (&optional set-mark number interactive data)
   (interactive)
index 3c96980..1a5ebad 100644 (file)
@@ -332,6 +332,59 @@ If nil, never search search parent by subject."
                 (const :tag "Don't search parent" nil))
   :group 'wl-summary)
 
+;;; Mark & Action
+(defcustom wl-summary-mark-action-list
+  '(("*"
+     wl-summary-set-target-mark
+     wl-summary-unset-target-mark
+     nil
+     wl-highlight-summary-temp-face)
+    ("d"
+     wl-summary-set-action-generic
+     wl-summary-unset-action-generic
+     wl-summary-exec-action-delete
+     wl-highlight-summary-deleted-face)
+    ("D"
+     wl-summary-set-action-generic
+     wl-summary-unset-action-generic
+     wl-summary-exec-action-erase
+     wl-highlight-summary-erased-face)
+    ("o"
+     wl-summary-set-action-refile
+     wl-summary-unset-action-refile
+     wl-summary-exec-action-refile
+     wl-highlight-summary-refiled-face)
+    ("O"
+     wl-summary-set-action-copy
+     wl-summary-unset-action-copy
+     wl-summary-exec-action-copy
+     wl-highlight-summary-copied-face)
+    ("i"
+     wl-summary-set-action-generic
+     wl-summary-unset-action-generic
+     wl-summary-exec-action-prefetch
+     wl-highlight-summary-prefetch-face))
+  "A variable to define Mark & Action.
+Each element of the list should be a list of
+\(MARK SET-MARK-FUNCTION UNSET-MARK-FUNCTION EXEC-FUNCTION FACE)
+MARK is a temporal mark string to define.
+SET-MARK-FUNCTION is a function called to set the mark.
+Its argument is (MARK NUMBER VISIBLE INTERACTIVE DATA).
+UNSET-MARK-FUNCTION is a function called to unset the mark.
+Its argument is (NUMBER).
+EXEC-FUNCTION is a function called to execute the action.
+Its argument is a list of MARK-INFO.
+MARK-INFO is a list of (NUMBER MARK DATA).
+DATA is the value which should be specified by `wl-summary-register-temp-mark'
+in the SET-MARK-FUNCTION.
+FACE is a face for highlighting."
+  :type '(repeat (string :tag "Temporary mark")
+                (symbol :tag "Set mark function")
+                (symbol :tag "Unset mark function")
+                (symbol :tag "Exec function")
+                (symbol :tag "Face symbol"))
+  :group 'wl-summary)
+
 ;; Important folders
 (defcustom wl-default-folder "%inbox"
   "*Default folder used in `wl-summary-goto-folder'."