* INSTALL, INSTALL.ja: Update.
[elisp/wanderlust.git] / wl / wl-mule.el
index e4e85cf..83748e8 100644 (file)
@@ -1,11 +1,10 @@
 ;;; wl-mule.el -- Wanderlust modules for Mule compatible Emacsen.
 ;;                (Mule2.3@19.28, Mule2.3@19.34, Emacs 20.x)
 
-;; Copyright 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
+;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
 
 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
 ;; Keywords: mail, net news
-;; Time-stamp: <2000-03-22 15:57:29 teranisi>
 
 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
 
 ;;
 
 ;;; Commentary:
-;; 
+;;
 
 ;;; Code:
-;; 
+;;
 
 (eval-when-compile
   (require 'wl-folder)
@@ -54,72 +53,63 @@ Special commands:
   "Highlight current folder line."
   (interactive)
   (save-excursion
-    (let ((highlights (list "opened" "closed"))
+    (end-of-line)
+    (let ((end (point))
+         (start (progn (beginning-of-line) (point)))
          (inhibit-read-only t)
-         (fld-name (wl-folder-get-folder-name-by-id
-                    (get-text-property (point) 'wl-folder-entity-id)))
-         fregexp fsymbol bol eol matched type extent num type)
-      (beginning-of-line)
-      (setq bol (point))
-      (save-excursion (end-of-line) (setq eol (point)))
-      (if (and numbers (nth 0 numbers) (nth 1 numbers))
-         (progn
-           (setq fsymbol 
-                 (let ((unsync (nth 0 numbers))
-                       (unread (nth 1 numbers)))
-                   (cond ((and unsync (eq unsync 0))
-                          (if (and unread (> unread 0))
-                              'wl-highlight-folder-unread-face
-                            'wl-highlight-folder-zero-face))
-                         ((and unsync 
-                               (>= unsync wl-folder-many-unsync-threshold))
-                          'wl-highlight-folder-many-face)
-                         (t
-                          'wl-highlight-folder-few-face))))
-           (put-text-property bol eol 'face fsymbol)
-           (setq matched t)))
-      (catch 'highlighted
-       (while highlights
-         (setq fregexp (symbol-value 
-                        (intern (format "wl-highlight-folder-%s-regexp" 
-                                        (car highlights)))))
-         (if (not wl-highlight-group-folder-by-numbers)
-             (setq fsymbol (intern (format "wl-highlight-folder-%s-face"
-                                           (car highlights)))))
-         (when (looking-at fregexp)
-           (put-text-property bol eol 'face fsymbol)
-           (setq matched t)
-           (throw 'highlighted nil))
-         (setq highlights (cdr highlights))))
-      (if (not matched)
-         (if (looking-at (format "^[ ]*\\(%s\\|%s\\)"
-                                 wl-folder-unsubscribe-mark
-                                 wl-folder-removed-mark))
-             (put-text-property bol eol 'face
-                                'wl-highlight-folder-killed-face)
-           (put-text-property bol eol 'face
-                              'wl-highlight-folder-unknown-face)))
-      (if wl-use-highlight-mouse-line 
-         (wl-highlight-folder-mouse-line)))))
-  
+         (text-face
+          (cond ((looking-at wl-highlight-folder-opened-regexp)
+                 'wl-highlight-folder-opened-face)
+                ((looking-at wl-highlight-folder-closed-regexp)
+                 'wl-highlight-folder-closed-face)
+                (t
+                 (if (looking-at (format "^[ \t]*\\(%s\\|%s\\)"
+                                         wl-folder-unsubscribe-mark
+                                         wl-folder-removed-mark))
+                     'wl-highlight-folder-killed-face
+                   'wl-highlight-folder-unknown-face)))))
+      (if (and wl-highlight-folder-by-numbers
+              numbers (nth 0 numbers) (nth 1 numbers)
+              (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" end t))
+         (let* ((unsync (nth 0 numbers))
+                (unread (nth 1 numbers))
+                (face (cond
+                       ((and unsync (zerop unsync))
+                        (if (and unread (zerop unread))
+                            'wl-highlight-folder-zero-face
+                          'wl-highlight-folder-unread-face))
+                       ((and unsync
+                             (>= unsync wl-folder-many-unsync-threshold))
+                        'wl-highlight-folder-many-face)
+                       (t
+                        'wl-highlight-folder-few-face))))
+           (if (numberp wl-highlight-folder-by-numbers)
+               (progn
+                 (put-text-property start (match-beginning 0) 'face text-face)
+                 (put-text-property (match-beginning 0) (point) 'face face))
+             ;; Remove previous face.
+             (put-text-property start (point) 'face nil)
+             (put-text-property start (point) 'face face))
+           (goto-char start))
+       (put-text-property start end 'face text-face)))
+    (when wl-use-highlight-mouse-line
+      (wl-highlight-folder-mouse-line))))
+
 (defun wl-highlight-plugged-current-line ())
 (defun wl-plugged-set-folder-icon (folder string)
   string)
 
-(defun wl-folder-init-icons ()) ; dummy.
-(defun wl-plugged-init-icons ()) ; dummy.
-
-(defun wl-xmas-setup-folder ()) ; dummy
-(defun wl-xmas-setup-summary ())
-(defun wl-xmas-setup-draft-toolbar ())
-
 (defun wl-message-overload-functions ()
   (local-set-key "l" 'wl-message-toggle-disp-summary)
   (local-set-key [mouse-2] 'wl-message-refer-article-or-url)
   (local-set-key [mouse-4] 'wl-message-wheel-down)
   (local-set-key [mouse-5] 'wl-message-wheel-up)
   (local-set-key [S-mouse-4] 'wl-message-wheel-down)
-  (local-set-key [S-mouse-5] 'wl-message-wheel-up))
+  (local-set-key [S-mouse-5] 'wl-message-wheel-up)
+  (if (fboundp 'set-keymap-parent)
+      (set-keymap-parent wl-message-button-map (current-local-map)))
+  (define-key wl-message-button-map [mouse-2]
+    'wl-message-button-dispatcher))
 
 (defun wl-message-wheel-up (event)
   (interactive "e")
@@ -153,7 +143,6 @@ Special commands:
 
 (defun wl-draft-key-setup ()
   (define-key wl-draft-mode-map "\C-c\C-y" 'wl-draft-yank-original)
-  (define-key wl-draft-mode-map "\C-c\C-a" 'wl-draft-insert-x-face-field)
   (define-key wl-draft-mode-map "\C-c\C-s" 'wl-draft-send)
   (define-key wl-draft-mode-map "\C-c\C-c" 'wl-draft-send-and-exit)
   (define-key wl-draft-mode-map "\C-c\C-z" 'wl-draft-save-and-exit)
@@ -167,6 +156,8 @@ Special commands:
   (define-key wl-draft-mode-map "\C-c\C-j" 'wl-template-select)
   (define-key wl-draft-mode-map "\C-c\C-p" 'wl-draft-preview-message)
   (define-key wl-draft-mode-map "\C-x\C-s" 'wl-draft-save)
+  (define-key wl-draft-mode-map "\C-c\C-a" 'wl-addrmgr)
+  (define-key wl-draft-mode-map "\C-c\C-x" 'wl-draft-insert-x-face-field)
   (define-key wl-draft-mode-map "\C-xk" 'wl-draft-mimic-kill-buffer))
 
 (defun wl-draft-overload-menubar ()
@@ -181,22 +172,17 @@ Special commands:
   (local-set-key [menu-bar mail signature]
     '("Insert Signature" . insert-signature))
   (local-set-key [menu-bar headers fcc]
-    '("FCC" . wl-draft-fcc)))
+    '("Fcc" . wl-draft-fcc)))
 
 (defun wl-draft-overload-functions ()
-  (setq mode-line-buffer-identification
-       (format "Wanderlust: %s" (buffer-name)))
-  (local-set-key "\C-c\C-s" 'wl-draft-send)    ; override
-  (wl-draft-overload-menubar)
-  (when wl-show-plug-status-on-modeline
-    (setq mode-line-format (wl-make-modeline))))
-
-(defalias 'wl-make-modeline 'wl-make-modeline-subr)
+  (wl-mode-line-buffer-identification)
+;;  (local-set-key "\C-c\C-s" 'wl-draft-send);; override
+  (wl-draft-overload-menubar))
 
 ;; for "ja-mule-canna-2.3.mini" on PocketBSD
 (defun-maybe make-face (a))
 
-(eval-when-compile 
+(eval-when-compile
   (require 'static))
 (static-cond
  ((and (fboundp 'defface)
@@ -233,7 +219,7 @@ Special commands:
 Each keyword should be listed in `custom-face-attributes'.
 
 If FRAME is nil, set the default face."
-    (while atts 
+    (while atts
       (let* ((name (nth 0 atts))
             (value (nth 1 atts))
             (fun (nth 1 (assq name wl-face-attributes))))
@@ -294,6 +280,12 @@ Warning: Unknown req `%S' with options `%S'" req options))
                             nil))))
        match)))))
 
-(provide 'wl-mule)
+(defun wl-read-event-char ()
+  "Get the next event."
+  (let ((event (read-event)))
+    (cons (and (numberp event) event) event)))
+
+(require 'product)
+(product-provide (provide 'wl-mule) (require 'wl-version))
 
 ;;; wl-mule.el ends here