Initial Commit
[packages] / xemacs-packages / mew / mew / contrib / mew-toolbar-frame.el
1 ;;; mew-toolbar-frame.el        -*-Emacs-Lisp-*-
2 ;;;
3 ;;; Commentary:
4 ;;; Run Mew from toolbar in a separate frame.
5 ;;;
6 ;;; Keywords:
7 ;;; Mew XEmacs ToolBar Frame
8 ;;;
9 ;;; Time-stamp: <99/07/02 16:37:17 jado@sophia>
10
11 ;;; How to use:
12 ;;; Require it when initialize.
13
14 ;;; Code:
15
16 (provide 'mew-toolbar-frame)
17
18 ;;;
19
20 (setq toolbar-mail-reader 'Mew)
21 (setq toolbar-mail-commands-alist
22       (cons '(Mew . toolbar-mew) toolbar-mail-commands-alist))
23
24 (defvar toolbar-mail-use-separate-frame t
25   "*Whether Mew is invoked in a separate frame.")
26 (defvar toolbar-mail-frame nil
27   "The frame in which Mew is displayed.")
28 (defvar toolbar-mail-frame-plist nil
29   "*The properties of the frame in which mail is displayed.")
30 (define-obsolete-variable-alias 'toolbar-mail-frame-properties
31   'toolbar-mail-frame-plist)
32
33 (defun toolbar-mew ()
34   "Run Mew in a separate frame."
35   (interactive)
36   (if (not toolbar-mail-use-separate-frame)
37       (mew)
38     (unless (frame-live-p toolbar-mail-frame)
39       (setq toolbar-mail-frame (make-frame toolbar-mail-frame-plist))
40       (add-hook 'mew-suspend-hook
41         (lambda ()
42           (when (frame-live-p toolbar-mail-frame)
43             (if (cdr (frame-list))
44                 (delete-frame toolbar-mail-frame))
45             (setq toolbar-mail-frame nil))))
46       (add-hook 'mew-quit-hook
47         (lambda ()
48           (when (frame-live-p toolbar-mail-frame)
49             (if (cdr (frame-list))
50                 (delete-frame toolbar-mail-frame))
51             (setq toolbar-mail-frame nil))))
52       (select-frame toolbar-mail-frame)
53       (mew))
54     (when (framep toolbar-mail-frame)
55       (when (frame-iconified-p toolbar-mail-frame)
56         (deiconify-frame toolbar-mail-frame))
57       (select-frame toolbar-mail-frame)
58       (raise-frame toolbar-mail-frame))))
59
60 ;;; mew-toolbar-frame.el ends here