1 ;;; emh-e21.el --- EMH modules for Emacs 21.
3 ;; Copyright (C) 2002 TSUMURA Tomoaki <tsumura@tomo.gr.jp>
5 ;; Author: TSUMURA Tomoaki <tsumura@tomo.gr.jp>
7 ;; This file is part of emh.
9 ;; This program is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU General Public License as
11 ;; published by the Free Software Foundation; either version 2, or (at
12 ;; your option) any later version.
14 ;; This program is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
26 ;; All code is stolen from wl-e21.el
28 (defvar-maybe mh-folder-mode-map (make-sparse-keymap))
31 (defvar emh-folder-toolbar
33 mh-show t "Show Mail"]
34 [mh-next-undeleted-msg
35 mh-next-undeleted-msg t "Next Message"]
36 [mh-previous-undeleted-msg
37 mh-previous-undeleted-msg t "Previous Message"]
39 mh-inc-folder t "Incorporate New Mails"]
41 mh-delete-msg t "Delete Message"]
43 mh-send t "New Message"]
45 mh-reply t "Reply Message"]
47 emh-forward t "Forward Message"]
49 mh-rescan-folder t "Rescan Folder"]
51 mh-quit t "Exit MH-E"]
53 "Folder buffer toolbar.")
55 (defvar emh-draft-toolbar
57 mh-send-letter t "Send Letter"]
59 mh-yank-cur-msg t "Yank and Cite Message"]
61 mh-insert-signature t "Insert Signature"]
62 [mime-edit-set-encrypt
63 mime-edit-set-encrypt t "PGP Encrypt"]
65 mime-edit-set-sign t "PGP Signature"]
67 mh-fully-kill-draft t "Delete Draft"]
71 (defun emh-e21-setup-toolbar (bar)
72 (when (and (display-images-p)
73 (image-type-available-p 'xpm))
74 (let ((load-path (cons emh-icon-directory load-path))
75 (props '(:type xpm :ascent center
76 :color-symbols (("backgroundToolBarColor" . "None"))
79 icon up down disabled name)
81 (setq icon (aref (pop bar) 0))
83 (setq name (symbol-name icon)
84 up (find-image `((,@props ,(concat name "-up.xpm")))))
86 (set icon (vector up up up up))
87 (setq bar nil success nil))
92 (defun emh-e21-make-toolbar-buttons (keymap defs)
93 (let ((configs '((auto-resize-tool-bars . t)
94 (auto-raise-tool-bar-buttons . t)
95 (tool-bar-button-margin . 0)
96 (tool-bar-button-relief . 2)))
98 (while (setq config (pop configs))
99 (set (make-local-variable (car config)) (cdr config))))
100 (let ((keys (cdr (key-binding [tool-bar] t)))
102 (while (setq item (pop keys))
103 (when (setq item (car-safe item))
104 (define-key keymap (vector 'tool-bar item) 'undefined))))
105 (let ((n (length defs))
110 (define-key keymap (vector 'tool-bar (aref def 1))
111 (list 'menu-item (aref def 3) (aref def 1)
113 :image (symbol-value (aref def 0)))))))
115 (defun emh-e21-setup-folder-toolbar ()
116 (when (emh-e21-setup-toolbar emh-folder-toolbar)
117 (emh-e21-make-toolbar-buttons mh-folder-mode-map emh-folder-toolbar)))
118 (add-hook 'mh-folder-mode-hook 'emh-e21-setup-folder-toolbar)
120 (defun emh-e21-setup-draft-toolbar ()
121 (when (emh-e21-setup-toolbar emh-draft-toolbar)
122 (emh-e21-make-toolbar-buttons mime-edit-mode-map emh-draft-toolbar)))
123 (add-hook 'mime-edit-mode-hook 'emh-e21-setup-draft-toolbar)
130 ;;; emh-e21.el ends here