(wl-summary-mark-as-read-internal): Fixed the behavior of
[elisp/wanderlust.git] / wl / wl-xmas.el
1 ;;; wl-xmas.el --- Wanderlust modules for XEmacsen.
2
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
4 ;;  Yuuichi Teranishi <teranisi@gohome.org>
5 ;; Copyright (C) 2000, 2001, 2002, 2003 Katsumi Yamaoka <yamaoka@jpl.org>
6
7 ;; Author: Yuuichi Teranishi <teranisi@gohome.org>
8 ;;      Katsumi Yamaoka <yamaoka@jpl.org>
9 ;; Keywords: mail, net news
10
11 ;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
12
13 ;; This program is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; any later version.
17 ;;
18 ;; This program is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;; GNU General Public License for more details.
22 ;;
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
27 ;;
28
29 ;;; Commentary:
30 ;;
31
32 ;;; Code:
33 ;;
34
35 (eval-when-compile
36   (require 'wl-folder)
37   (require 'wl-summary)
38   (require 'wl-draft)
39   (require 'wl-message)
40   (require 'wl-highlight)
41   (defvar-maybe wl-draft-mode-map (make-sparse-keymap))
42   (defalias-maybe 'toolbar-make-button-list 'ignore))
43
44 (add-hook 'wl-folder-mode-hook 'wl-setup-folder)
45 (add-hook 'wl-folder-mode-hook 'wl-folder-init-icons)
46
47 (add-hook 'wl-init-hook 'wl-biff-init-icons)
48 (add-hook 'wl-init-hook 'wl-plugged-init-icons)
49
50 (add-hook 'wl-summary-mode-hook 'wl-setup-summary)
51
52 (add-hook 'wl-message-display-internal-hook 'wl-setup-message)
53
54 (defvar wl-use-toolbar (if (featurep 'toolbar) 'default-toolbar nil))
55 (defvar wl-plugged-glyph nil)
56 (defvar wl-unplugged-glyph nil)
57 (defvar wl-biff-mail-glyph nil)
58 (defvar wl-biff-nomail-glyph nil)
59
60 (defvar wl-folder-toolbar
61   '([wl-folder-jump-to-current-entity
62      wl-folder-jump-to-current-entity t "Enter Current Folder"]
63     [wl-folder-next-entity
64      wl-folder-next-entity t "Next Folder"]
65     [wl-folder-prev-entity
66      wl-folder-prev-entity t "Previous Folder"]
67     [wl-folder-check-current-entity
68      wl-folder-check-current-entity t "Check Current Folder"]
69     [wl-folder-sync-current-entity
70      wl-folder-sync-current-entity t "Sync Current Folder"]
71     [wl-draft
72      wl-draft t "Write a New Message"]
73     [wl-folder-goto-draft-folder
74      wl-folder-goto-draft-folder t "Go to Draft Folder"]
75     [wl-folder-empty-trash
76      wl-folder-empty-trash t "Empty Trash"]
77     [wl-exit
78      wl-exit t "Quit Wanderlust"]
79     )
80   "The Folder buffer toolbar.")
81
82 (defvar wl-summary-toolbar
83   '([wl-summary-read
84      wl-summary-read t "Read Messages"]
85     [wl-summary-next
86      wl-summary-next t "Next Message"]
87     [wl-summary-prev
88      wl-summary-prev t "Previous Message"]
89     [wl-summary-jump-to-current-message
90      wl-summary-jump-to-current-message t "Jump to Current Message"]
91     [wl-summary-sync-force-update
92      wl-summary-sync-force-update t "Sync Current Folder"]
93     [wl-summary-dispose
94      wl-summary-dispose t "Dispose Current Message"]
95     [wl-summary-mark-as-important
96      wl-summary-mark-as-important t "Mark Current Message as Important"]
97     [wl-draft
98      wl-summary-write-current-folder t "Write for Current Folder"]
99     [wl-summary-reply
100      wl-summary-reply t "Reply to Current Message" ]
101     [wl-summary-reply-with-citation
102      wl-summary-reply-with-citation t "Reply to Current Message with Citation"]
103     [wl-summary-forward
104      wl-summary-forward t "Forward Current Message"]
105     [wl-summary-exit
106      wl-summary-exit t "Exit Current Summary"]
107     )
108   "The Summary buffer toolbar.")
109
110 (defvar wl-message-toolbar
111   '([wl-message-read
112      wl-message-read t "Read Contents"]
113     [wl-message-next-content
114      wl-message-next-content t "Next Content"]
115     [wl-message-prev-content
116      wl-message-prev-content t "Previous Content"]
117     [wl-message-quit
118      wl-message-quit t "Back to Summary"]
119     [wl-message-play-content
120      wl-message-play-content t "Play Content"]
121     [wl-message-extract-content
122      wl-message-extract-content t "Extract Content"]
123     )
124   "The Message buffer toolbar.")
125
126 (defalias 'wl-draft-insert-signature 'insert-signature);; for draft toolbar.
127
128 (defvar wl-draft-toolbar
129   '([wl-draft-send-from-toolbar
130      wl-draft-send-from-toolbar t "Send Current Draft"]
131     [wl-draft-yank-original
132      wl-draft-yank-original t "Yank Displaying Message"]
133     [wl-draft-insert-signature
134      wl-draft-insert-signature t "Insert Signature"]
135     [wl-draft-kill
136      wl-draft-kill t "Kill Current Draft"]
137     [wl-draft-save-and-exit
138      wl-draft-save-and-exit t "Save Draft and Exit"]
139     )
140   "The Draft buffer toolbar.")
141
142 (defun wl-xmas-setup-toolbar (bar)
143   (let ((dir wl-icon-directory)
144         icon up down disabled name)
145     (when dir
146       (while bar
147         (setq icon (aref (car bar) 0)
148               name (symbol-name icon)
149               bar (cdr bar))
150         (unless (boundp icon)
151           (setq up (expand-file-name (concat name "-up.xpm") dir)
152                 down (expand-file-name (concat name "-down.xpm") dir)
153                 disabled (expand-file-name (concat name "-disabled.xpm") dir))
154           (if (file-exists-p up)
155               (set icon (toolbar-make-button-list
156                          up (and (file-exists-p down) down)
157                          (and (file-exists-p disabled) disabled)))
158             (setq bar nil
159                   dir nil)))))
160     dir))
161
162 (defun wl-xmas-make-icon-glyph (icon-string icon-file
163                                             &optional locale tag-set)
164   (let ((glyph (make-glyph (vector 'string :data icon-string))))
165     (when wl-highlight-folder-with-icon
166       (set-glyph-image glyph
167                        (vector 'xpm :file (expand-file-name
168                                            icon-file wl-icon-directory))
169                        locale tag-set 'prepend))
170     glyph))
171
172 (eval-when-compile
173   (defsubst wl-xmas-setup-folder-toolbar ()
174     (and wl-use-toolbar
175          (wl-xmas-setup-toolbar wl-folder-toolbar)
176          (set-specifier (symbol-value wl-use-toolbar)
177                         (cons (current-buffer) wl-folder-toolbar))))
178
179   (defsubst wl-xmas-setup-summary-toolbar ()
180     (and wl-use-toolbar
181          (wl-xmas-setup-toolbar wl-summary-toolbar)
182          (set-specifier (symbol-value wl-use-toolbar)
183                         (cons (current-buffer) wl-summary-toolbar))))
184
185   (defsubst wl-xmas-setup-draft-toolbar ()
186     (and wl-use-toolbar
187          (wl-xmas-setup-toolbar wl-draft-toolbar)
188          (set-specifier (symbol-value wl-use-toolbar)
189                         (cons (current-buffer) wl-draft-toolbar)))))
190
191 (defun wl-xmas-setup-message-toolbar ()
192   (and wl-use-toolbar
193        (wl-xmas-setup-toolbar wl-message-toolbar)
194        (set-specifier (symbol-value wl-use-toolbar)
195                       (cons (current-buffer) wl-message-toolbar))))
196
197 (defvar wl-folder-toggle-icon-list
198   '((wl-folder-opened-glyph       . wl-opened-group-folder-icon)
199     (wl-folder-closed-glyph       . wl-closed-group-folder-icon)))
200
201 (eval-when-compile
202   (defsubst wl-xmas-highlight-folder-group-line (glyph text-face numbers)
203     (let ((start (match-beginning 1))
204           (end (match-end 1)))
205       (let ((extent (or (map-extents
206                          (lambda (extent maparg)
207                            (and (eq start (extent-start-position extent))
208                                 (eq end (extent-end-position extent))
209                                 extent))
210                          nil start start nil nil 'end-glyph)
211                         (make-extent start end))))
212         (set-extent-properties extent `(end-open t start-closed t invisible t))
213         (set-extent-end-glyph
214          extent
215          (or (get glyph 'glyph)
216              (put glyph 'glyph
217                   (wl-xmas-make-icon-glyph
218                    (buffer-substring-no-properties start end)
219                    (symbol-value
220                     (cdr (assq glyph wl-folder-toggle-icon-list))))))))
221       (let ((inhibit-read-only t))
222         (when wl-use-highlight-mouse-line
223           (put-text-property start (point-at-eol) 'mouse-face 'highlight))
224         (setq start end
225               end (point-at-eol))
226         (if (and wl-highlight-folder-by-numbers
227                  numbers (nth 0 numbers) (nth 1 numbers)
228                  (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" end t))
229             (let* ((unsync (nth 0 numbers))
230                    (unread (nth 1 numbers))
231                    (face (cond ((and unsync (zerop unsync))
232                                 (if (and unread (zerop unread))
233                                     'wl-highlight-folder-zero-face
234                                   'wl-highlight-folder-unread-face))
235                                ((and unsync
236                                      (>= unsync
237                                          wl-folder-many-unsync-threshold))
238                                 'wl-highlight-folder-many-face)
239                                (t
240                                 'wl-highlight-folder-few-face))))
241               (if (numberp wl-highlight-folder-by-numbers)
242                   (progn
243                     (put-text-property start (match-beginning 0)
244                                        'face text-face)
245                     (put-text-property (match-beginning 0) (point) 'face face))
246                 (put-text-property start end 'face face)))
247           (put-text-property start end 'face text-face))))))
248
249 (defun wl-highlight-folder-current-line (&optional numbers)
250   (interactive)
251   (save-excursion
252     (beginning-of-line)
253     (let (fld-name)
254       (cond
255        (;; opened folder group
256         (and (wl-folder-buffer-group-p)
257              (looking-at wl-highlight-folder-opened-regexp))
258         (wl-xmas-highlight-folder-group-line 'wl-folder-opened-glyph
259                                              'wl-highlight-folder-opened-face
260                                              numbers))
261        (;; closed folder group
262         (and (wl-folder-buffer-group-p)
263              (looking-at wl-highlight-folder-closed-regexp))
264         (wl-xmas-highlight-folder-group-line 'wl-folder-closed-glyph
265                                              'wl-highlight-folder-closed-face
266                                              numbers))
267        (;; basic folder
268         (and (setq fld-name (wl-folder-get-folder-name-by-id
269                              (get-text-property (point) 'wl-folder-entity-id)))
270              (looking-at "[ \t]+\\([^ \t]+\\)"))
271         (let ((start (match-beginning 1)))
272           (let ((extent (or (map-extents
273                              (lambda (extent maparg)
274                                (and (eq start (extent-start-position extent))
275                                     (eq start (extent-end-position extent))
276                                     extent))
277                              nil start start nil nil 'begin-glyph)
278                             (make-extent start start))))
279             (let (type)
280               (set-extent-begin-glyph
281                extent
282                (cond
283                 ((string= fld-name wl-trash-folder);; trash folder
284                  (let ((num (nth 2 numbers)));; number of messages
285                    (get (if (or (not num) (zerop num))
286                             'wl-folder-trash-empty-glyph
287                           'wl-folder-trash-glyph)
288                         'glyph)))
289                 ((string= fld-name wl-draft-folder);; draft folder
290                  (get 'wl-folder-draft-glyph 'glyph))
291                 ((string= fld-name wl-queue-folder);; queue folder
292                  (get 'wl-folder-queue-glyph 'glyph))
293                 (;; and one of many other folders
294                  (setq type (elmo-folder-type fld-name))
295                  (get (intern (format "wl-folder-%s-glyph" type)) 'glyph))))))
296           (let ((end (point-at-eol)))
297             (when wl-use-highlight-mouse-line
298               (put-text-property start end 'mouse-face 'highlight))
299             (let ((text-face
300                    (if (looking-at (format "^[ \t]*\\(?:%s\\|%s\\)"
301                                            wl-folder-unsubscribe-mark
302                                            wl-folder-removed-mark))
303                        'wl-highlight-folder-killed-face
304                      'wl-highlight-folder-unknown-face)))
305               (if (and wl-highlight-folder-by-numbers
306                        numbers (nth 0 numbers) (nth 1 numbers)
307                        (re-search-forward "[0-9-]+/[0-9-]+/[0-9-]+" end t))
308                   (let* ((unsync (nth 0 numbers))
309                          (unread (nth 1 numbers))
310                          (face (cond
311                                 ((and unsync (zerop unsync))
312                                  (if (and unread (zerop unread))
313                                      'wl-highlight-folder-zero-face
314                                    'wl-highlight-folder-unread-face))
315                                 ((and unsync
316                                       (>= unsync
317                                           wl-folder-many-unsync-threshold))
318                                  'wl-highlight-folder-many-face)
319                                 (t
320                                  'wl-highlight-folder-few-face))))
321                     (if (numberp wl-highlight-folder-by-numbers)
322                         (progn
323                           (put-text-property start (match-beginning 0)
324                                              'face text-face)
325                           (put-text-property (match-beginning 0)
326                                              (match-end 0)
327                                              'face face))
328                       ;; Remove previous face.
329                       (put-text-property start (match-end 0) 'face nil)
330                       (put-text-property start (match-end 0) 'face face)))
331                 (put-text-property start end 'face text-face))))))))))
332
333 (defun wl-highlight-plugged-current-line ()
334   (interactive)
335   (save-excursion
336     (let ((inhibit-read-only t)
337           extent switch)
338       (beginning-of-line)
339       (when (looking-at "[ \t]*\\(\\[\\([^]]+\\)\\]\\)")
340         (setq switch (elmo-match-buffer 2))
341         (when (and (setq extent (extent-at (match-end 1) nil nil nil 'at))
342                    (extent-end-glyph extent))
343           (delete-extent extent))
344         (setq extent (make-extent (match-beginning 1) (match-end 1)))
345         (set-extent-property extent 'end-open t)
346         (set-extent-property extent 'start-closed t)
347         (set-extent-property extent 'invisible t)
348         (set-extent-end-glyph extent (if (string= switch wl-plugged-plug-on)
349                                          wl-plugged-glyph
350                                        wl-unplugged-glyph))))))
351
352 (defun wl-plugged-set-folder-icon (folder string)
353   (let ((string (copy-sequence string))
354         (len (length string))
355         type)
356     (if (string= folder wl-queue-folder)
357         (put-text-property 0 len 'begin-glyph
358                            (get 'wl-folder-queue-glyph 'glyph)
359                            string)
360       (if (setq type (elmo-folder-type folder))
361           (put-text-property 0 len
362                              'begin-glyph
363                              (get (intern (format "wl-folder-%s-glyph" type))
364                                   'glyph)
365                              string)))
366     string))
367
368 (defvar wl-folder-internal-icon-list
369   ;; alist of (glyph . icon-file)
370   '((wl-folder-nntp-glyph       . wl-nntp-folder-icon)
371     (wl-folder-imap4-glyph      . wl-imap-folder-icon)
372     (wl-folder-pop3-glyph       . wl-pop-folder-icon)
373     (wl-folder-localdir-glyph   . wl-localdir-folder-icon)
374     (wl-folder-localnews-glyph  . wl-localnews-folder-icon)
375     (wl-folder-internal-glyph   . wl-internal-folder-icon)
376     (wl-folder-multi-glyph      . wl-multi-folder-icon)
377     (wl-folder-filter-glyph     . wl-filter-folder-icon)
378     (wl-folder-archive-glyph    . wl-archive-folder-icon)
379     (wl-folder-pipe-glyph       . wl-pipe-folder-icon)
380     (wl-folder-maildir-glyph    . wl-maildir-folder-icon)
381     (wl-folder-nmz-glyph        . wl-nmz-folder-icon)
382     (wl-folder-shimbun-glyph    . wl-shimbun-folder-icon)
383     (wl-folder-trash-empty-glyph . wl-empty-trash-folder-icon)
384     (wl-folder-draft-glyph      . wl-draft-folder-icon)
385     (wl-folder-queue-glyph      . wl-queue-folder-icon)
386     (wl-folder-trash-glyph      . wl-trash-folder-icon)))
387
388 (defun wl-folder-init-icons ()
389   (dolist (icon wl-folder-internal-icon-list)
390     (unless (get (car icon) 'glyph)
391       (put (car icon) 'glyph
392            (wl-xmas-make-icon-glyph "" (symbol-value (cdr icon)))))))
393
394 (defun wl-plugged-init-icons ()
395   (unless wl-plugged-glyph
396     (setq wl-plugged-glyph (wl-xmas-make-icon-glyph
397                             wl-plug-state-indicator-on wl-plugged-icon)
398           wl-unplugged-glyph (wl-xmas-make-icon-glyph
399                               wl-plug-state-indicator-off wl-unplugged-icon))
400     (let ((extent (make-extent nil nil)))
401       (let ((keymap (make-sparse-keymap)))
402         (define-key keymap 'button2
403           (make-modeline-command-wrapper 'wl-toggle-plugged))
404         (set-extent-keymap extent keymap)
405         (set-extent-property extent 'help-echo
406                              "button2 toggles plugged status"))
407       (setq wl-modeline-plug-state-on (cons extent wl-plugged-glyph)
408             wl-modeline-plug-state-off (cons extent wl-unplugged-glyph)))))
409
410 (defun wl-biff-init-icons ()
411   (unless wl-biff-mail-glyph
412     (setq wl-biff-mail-glyph (wl-xmas-make-icon-glyph
413                               wl-biff-state-indicator-on
414                               wl-biff-mail-icon)
415           wl-biff-nomail-glyph (wl-xmas-make-icon-glyph
416                                 wl-biff-state-indicator-off
417                                 wl-biff-nomail-icon))
418     (let ((extent (make-extent nil nil)))
419       (let ((keymap (make-sparse-keymap)))
420         (define-key keymap 'button2
421           (make-modeline-command-wrapper 'wl-biff-check-folders))
422         (set-extent-keymap extent keymap)
423         (set-extent-property extent 'help-echo "button2 checks new mails"))
424       (setq wl-modeline-biff-state-on (cons extent wl-biff-mail-glyph)
425             wl-modeline-biff-state-off (cons extent wl-biff-nomail-glyph)))))
426
427 (defun wl-make-date-string ()
428   (let ((s (current-time-string)))
429     (string-match "\\`\\([A-Z][a-z][a-z]\\) +[A-Z][a-z][a-z] +[0-9][0-9]? *[0-9][0-9]?:[0-9][0-9]:[0-9][0-9] *[0-9]?[0-9]?[0-9][0-9]"
430                   s)
431     (concat (wl-match-string 1 s) ", "
432             (timezone-make-date-arpa-standard s (current-time-zone)))))
433
434 (defun wl-setup-folder ()
435   (and (featurep 'scrollbar)
436        (set-specifier scrollbar-height (cons (current-buffer) 0)))
437   (wl-xmas-setup-folder-toolbar))
438
439 (defvar dragdrop-drop-functions)
440
441 (defun wl-setup-summary ()
442   (make-local-variable 'dragdrop-drop-functions)
443   (setq dragdrop-drop-functions '((wl-dnd-default-drop-message t t)))
444   (and (featurep 'scrollbar)
445        (set-specifier scrollbar-height (cons (current-buffer) 0)))
446   (wl-xmas-setup-summary-toolbar))
447
448 (defalias 'wl-setup-message 'wl-xmas-setup-message-toolbar)
449
450 (defun wl-message-define-keymap ()
451   (let ((keymap (make-sparse-keymap)))
452     (define-key keymap "D" 'wl-message-delete-current-part)
453     (define-key keymap "l" 'wl-message-toggle-disp-summary)
454     (define-key keymap "\C-c:d" 'wl-message-decrypt-pgp-nonmime)
455     (define-key keymap "\C-c:v" 'wl-message-verify-pgp-nonmime)
456     (define-key keymap 'button4 'wl-message-wheel-down)
457     (define-key keymap 'button5 'wl-message-wheel-up)
458     (define-key keymap [(shift button4)] 'wl-message-wheel-down)
459     (define-key keymap [(shift button5)] 'wl-message-wheel-up)
460     (set-keymap-parent wl-message-button-map keymap)
461     (define-key wl-message-button-map 'button2
462       'wl-message-button-dispatcher)
463     keymap))
464
465 (defun wl-message-wheel-up (event)
466   (interactive "e")
467   (if (string-match (regexp-quote wl-message-buffer-name)
468                     (regexp-quote (buffer-name)))
469       (wl-message-prev-page)
470     (let ((cur-buf (current-buffer))
471           proceed)
472       (save-selected-window
473         (select-window (event-window event))
474         (set-buffer cur-buf)
475         (setq proceed (wl-message-next-page)))
476       (when proceed
477         (if (memq 'shift (event-modifiers event))
478             (wl-summary-down t)
479           (wl-summary-next t))))))
480
481 (defun wl-message-wheel-down (event)
482   (interactive "e")
483   (if (string-match (regexp-quote wl-message-buffer-name)
484                     (regexp-quote (buffer-name)))
485       (wl-message-prev-page)
486     (let ((cur-buf (current-buffer))
487           proceed)
488       (save-selected-window
489         (select-window (event-window event))
490         (set-buffer cur-buf)
491         (setq proceed (wl-message-prev-page)))
492       (when proceed
493         (if (memq 'shift (event-modifiers event))
494             (wl-summary-up t)
495           (wl-summary-prev t))))))
496
497 (defun wl-draft-overload-menubar ()
498   (when (featurep 'menubar)
499     (add-menu-item '("Mail") "Send, Keep Editing"
500                    'wl-draft-send t "Send Mail")
501     (add-menu-item '("Mail") "Send Message"
502                    'wl-draft-send-and-exit t "Send and Exit")
503     (delete-menu-item '("Mail" "Send Mail"))
504     (delete-menu-item '("Mail" "Send and Exit"))
505     (add-menu-item '("Mail") "Preview Message"
506                    'wl-draft-preview-message t "Cancel")
507     (add-menu-item '("Mail") "Save Draft and Exit"
508                    'wl-draft-save-and-exit t "Cancel")
509     (add-menu-item '("Mail") "Kill Current Draft"
510                    'wl-draft-kill t "Cancel")
511     (delete-menu-item '("Mail" "Cancel"))))
512
513 (defun wl-draft-mode-setup ()
514   (require 'derived)
515   (define-derived-mode wl-draft-mode mail-mode "Draft"
516     "draft mode for Wanderlust derived from mail mode.
517 See info under Wanderlust for full documentation.
518
519 Special commands:
520 \\{wl-draft-mode-map}"))
521
522 (defun wl-draft-key-setup ()
523   (define-key wl-draft-mode-map "\C-c\C-y" 'wl-draft-yank-original)
524   (define-key wl-draft-mode-map "\C-c\C-s" 'wl-draft-send)
525   (define-key wl-draft-mode-map "\C-c\C-c" 'wl-draft-send-and-exit)
526   (define-key wl-draft-mode-map "\C-c\C-z" 'wl-draft-save-and-exit)
527   (define-key wl-draft-mode-map "\C-c\C-k" 'wl-draft-kill)
528   (define-key wl-draft-mode-map "\C-l" 'wl-draft-highlight-and-recenter)
529   (define-key wl-draft-mode-map "\C-i" 'wl-complete-field-body-or-tab)
530   (define-key wl-draft-mode-map "\C-c\C-r" 'wl-draft-caesar-region)
531   (define-key wl-draft-mode-map "\M-t" 'wl-toggle-plugged)
532   (define-key wl-draft-mode-map "\C-c\C-o" 'wl-jump-to-draft-buffer)
533   (define-key wl-draft-mode-map "\C-c\C-e" 'wl-draft-config-exec)
534   (define-key wl-draft-mode-map "\C-c\C-j" 'wl-template-select)
535   (define-key wl-draft-mode-map "\C-c\C-p" 'wl-draft-preview-message)
536 ;;   (define-key wl-draft-mode-map "\C-x\C-s" 'wl-draft-save)
537   (define-key wl-draft-mode-map "\C-c\C-a" 'wl-addrmgr)
538   (define-key wl-draft-mode-map "\C-xk"    'wl-draft-mimic-kill-buffer)
539   (define-key wl-draft-mode-map "\C-c\C-d" 'wl-draft-elide-region)
540   (define-key wl-draft-mode-map "\C-a" 'wl-draft-beginning-of-line))
541
542 (defun wl-draft-overload-functions ()
543   (wl-mode-line-buffer-identification)
544   ;; (local-set-key "\C-c\C-s" 'wl-draft-send);; override
545   (wl-xmas-setup-draft-toolbar)
546   (wl-draft-overload-menubar))
547
548 (defalias 'wl-defface 'defface)
549
550 (defun wl-read-event-char ()
551   "Get the next event."
552   (let ((event (next-command-event)))
553     (sit-for 0)
554     ;; We junk all non-key events.  Is this naughty?
555     (while (not (or (key-press-event-p event)
556                     (button-press-event-p event)))
557       (dispatch-event event)
558       (setq event (next-command-event)))
559     (cons (and (key-press-event-p event)
560                (event-to-character event))
561           event)))
562
563 (require 'product)
564 (product-provide (provide 'wl-xmas) (require 'wl-version))
565
566 ;;; wl-xmas.el ends here