Write more about elmo-split.
[elisp/wanderlust.git] / wl / wl-highlight.el
index e10e270..399befc 100644 (file)
@@ -1,6 +1,7 @@
 ;;; wl-highlight.el --- Hilight modules for Wanderlust.
 
-;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+;;  Yuuichi Teranishi <teranisi@gohome.org>
 
 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
 ;; Keywords: mail, net news
         (require 'wl-e21))
        (t
         (require 'wl-mule)))
-  (defun-maybe extent-begin-glyph (a))
-  (defun-maybe delete-extent (a))
-  (defun-maybe make-extent (a b))
-  (defun-maybe set-extent-begin-glyph (a b))
-  (defun-maybe set-extent-end-glyph (a b))
-  (defun-maybe extent-at (a b c d e))
   (defun-maybe wl-dnd-set-drop-target (a b))
   (defun-maybe wl-dnd-set-drag-starter (a b)))
 
 (defvar wl-highlight-folder-closed-regexp " *\\(\\[\\+\\]\\)")
 (defvar wl-highlight-folder-leaf-regexp "[ ]*\\([-%\\+]\\)\\(.*\\):.*$")
 
-(defvar wl-highlight-summary-unread-regexp " *[0-9]+[^0-9]\\(!\\|U\\)")
-(defvar wl-highlight-summary-important-regexp " *[0-9]+[^0-9]\\$")
-(defvar wl-highlight-summary-new-regexp " *[0-9]+[^0-9]N")
-(defvar wl-highlight-summary-deleted-regexp " *[0-9]+D")
-(defvar wl-highlight-summary-refiled-regexp " *[0-9]+o")
-(defvar wl-highlight-summary-copied-regexp " *[0-9]+O")
-(defvar wl-highlight-summary-target-regexp " *[0-9]+\\*")
-;;(defvar wl-highlight-summary-thread-top-regexp " *[0-9]+[^0-9][^0-9]../..\(.*\)..:.. \\[")
-
 (defvar wl-highlight-citation-face-list
   '(wl-highlight-message-cited-text-1
     wl-highlight-message-cited-text-2
 
 (defun wl-highlight-summary-line-string (line mark temp-mark indent)
   (let (fsymbol)
-    (cond ((and (string= temp-mark "+")
+    (cond ((and (string= temp-mark wl-summary-score-over-mark)
                (member mark (list wl-summary-unread-cached-mark
                                   wl-summary-unread-uncached-mark
                                   wl-summary-new-mark)))
           (setq fsymbol 'wl-highlight-summary-high-unread-face))
-         ((and (string= temp-mark "-")
+         ((and (string= temp-mark wl-summary-score-below-mark)
                (member mark (list wl-summary-unread-cached-mark
                                   wl-summary-unread-uncached-mark
                                   wl-summary-new-mark)))
           (setq fsymbol 'wl-highlight-summary-unread-face))
          ((or (string= mark wl-summary-important-mark))
           (setq fsymbol 'wl-highlight-summary-important-face))
-         ((string= temp-mark "-")
+         ((string= temp-mark wl-summary-score-below-mark)
           (setq fsymbol 'wl-highlight-summary-low-read-face))
-         ((string= temp-mark "+")
+         ((string= temp-mark wl-summary-score-over-mark)
           (setq fsymbol 'wl-highlight-summary-high-read-face))
          (t (if (zerop (length indent))
                 (setq fsymbol 'wl-highlight-summary-thread-top-face)
                dest t))))
       (if (not fsymbol)
          (cond
-          ((and (string= temp-mark "+")
+          ((and (string= temp-mark wl-summary-score-over-mark)
                 (member status-mark (list wl-summary-unread-cached-mark
                                           wl-summary-unread-uncached-mark
                                           wl-summary-new-mark)))
            (setq fsymbol 'wl-highlight-summary-high-unread-face))
-          ((and (string= temp-mark "-")
+          ((and (string= temp-mark wl-summary-score-below-mark)
                 (member status-mark (list wl-summary-unread-cached-mark
                                           wl-summary-unread-uncached-mark
                                           wl-summary-new-mark)))
           ((string= status-mark wl-summary-important-mark)
            (setq fsymbol 'wl-highlight-summary-important-face))
           ;; score mark
-          ((string= temp-mark "-")
+          ((string= temp-mark wl-summary-score-below-mark)
            (setq fsymbol 'wl-highlight-summary-low-read-face))
-          ((string= temp-mark "+")
+          ((string= temp-mark wl-summary-score-over-mark)
            (setq fsymbol 'wl-highlight-summary-high-read-face))
           ;;
           (t (if (null
@@ -954,7 +940,7 @@ Variables used:
   (interactive)
   (wl-highlight-summary (point-min)(point-max)))
 
-(defun wl-highlight-summary (start end)
+(defun wl-highlight-summary (start end &optional lazy)
   "Highlight summary between start and end.
 Faces used:
   wl-highlight-summary-unread-face      unread messages
@@ -962,16 +948,7 @@ Faces used:
   wl-highlight-summary-deleted-face     messages mark as deleted
   wl-highlight-summary-refiled-face     messages mark as refiled
   wl-highlight-summary-copied-face      messages mark as copied
-  wl-highlight-summary-new-face         new messages
-
-Variables used:
-  wl-highlight-summary-unread-regexp    matches unread messages
-  wl-highlight-summary-important-regexp matches important messages
-  wl-highlight-summary-deleted-regexp   matches messages mark as deleted
-  wl-highlight-summary-refiled-regexp   matches messages mark as refiled
-  wl-highlight-summary-copied-regexp    matches messages mark as copied
-  wl-highlight-summary-new-regexp       matches new messages
-"
+  wl-highlight-summary-new-face         new messages"
   (if (< end start)
       (let ((s start)) (setq start end end s)))
   (let (lines too-big gc-message e p hend i percent)
@@ -984,9 +961,11 @@ Variables used:
       (setq i 0)
       (while (and (not (eobp))
                  (< (point) end))
-       (wl-highlight-summary-current-line nil nil
-                                          (or wl-summary-lazy-highlight
-                                              wl-summary-scored))
+       (when (or (not lazy)
+                 (null (get-text-property (point) 'face)))
+         (wl-highlight-summary-current-line nil nil
+                                            (or wl-summary-lazy-highlight
+                                                wl-summary-scored)))
        (forward-line 1))
       (unless wl-summary-lazy-highlight
        (message "Highlighting...done")))))
@@ -998,10 +977,8 @@ This function is defined for `window-scroll-functions'"
       (with-current-buffer (window-buffer win)
        (when (eq major-mode 'wl-summary-mode)
          (wl-highlight-summary (window-start win)
-                               (save-excursion
-                                 (goto-char (window-start win))
-                                 (forward-line (frame-height))
-                                 (point)))
+                               (window-end win)
+                               'lazy)
          (set-buffer-modified-p nil)))))
 
 (defun wl-highlight-headers (&optional for-draft)