1 ;;; cal-x.el --- calendar windows in dedicated frames in x-windows
3 ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 ;; Edward M. Reingold <reingold@cs.uiuc.edu>
8 ;; Human-Keywords: calendar, dedicated frames, x-windows
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;; This collection of functions implements dedicated frames in x-windows for
31 ;; Comments, corrections, and improvements should be sent to
32 ;; Edward M. Reingold Department of Computer Science
33 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
34 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
35 ;; Urbana, Illinois 61801
39 (defvar calendar-frame nil
"Frame in which to display the calendar.")
41 (defvar diary-frame nil
"Frame in which to display the diary.")
43 (defvar diary-frame-parameters
44 '((name .
"Diary") (height .
10) (width .
80) (unsplittable . t
)
45 (font .
"6x13") (auto-lower . t
) (auto-raise . t
) (minibuffer . nil
))
46 "Parameters of the diary frame, if the diary is in its own frame.
47 Location and color should be set in .Xdefaults.")
49 (defvar calendar-frame-parameters
50 '((name .
"Calendar") (minibuffer . nil
) (height .
10) (width .
80)
51 (auto-raise . t
) (auto-lower . t
) (font .
"6x13") (unsplittable . t
)
52 (vertical-scroll-bars . nil
))
53 "Parameters of the calendar frame, if the calendar is in a separate frame.
54 Location and color should be set in .Xdefaults.")
56 (defvar calendar-and-diary-frame-parameters
57 '((name .
"Calendar") (height .
28) (width .
80) (minibuffer . nil
)
58 (font .
"6x13") (auto-raise . t
) (auto-lower . t
))
59 "Parameters of the frame that displays both the calendar and the diary.
60 Location and color should be set in .Xdefaults.")
62 (defvar calendar-after-frame-setup-hooks nil
63 "Hooks to be run just after setting up a calendar frame.
64 Can be used to change frame parameters, such as font, color, location, etc.")
66 (defun calendar-one-frame-setup (&optional arg
)
67 "Start calendar and display it in a dedicated frame together with the diary."
68 (if (not window-system
)
69 (calendar-basic-setup arg
)
70 (if (frame-live-p calendar-frame
) (delete-frame calendar-frame
))
71 (if (frame-live-p diary-frame
) (delete-frame diary-frame
))
72 (let ((special-display-buffer-names nil
)
73 (view-diary-entries-initially t
))
74 (save-window-excursion
77 (make-frame calendar-and-diary-frame-parameters
))
78 (run-hooks 'calendar-after-frame-setup-hooks
)
79 (select-frame calendar-frame
)
80 (if (eq 'icon
(cdr (assoc 'visibility
81 (frame-parameters calendar-frame
))))
82 (iconify-or-deiconify-frame))
83 (calendar-basic-setup arg
)
84 (set-window-dedicated-p (selected-window) 'calendar
)
85 (set-window-dedicated-p
87 (if (not (memq 'fancy-diary-display diary-display-hook
))
88 (get-file-buffer diary-file
)
89 (if (not (bufferp (get-buffer fancy-diary-buffer
)))
90 (make-fancy-diary-buffer))
94 (defun calendar-two-frame-setup (&optional arg
)
95 "Start calendar and diary in separate, dedicated frames."
96 (if (not window-system
)
97 (calendar-basic-setup arg
)
98 (if (frame-live-p calendar-frame
) (delete-frame calendar-frame
))
99 (if (frame-live-p diary-frame
) (delete-frame diary-frame
))
100 (let ((pop-up-windows nil
)
101 (view-diary-entries-initially nil
)
102 (special-display-buffer-names nil
))
103 (save-window-excursion
104 (save-excursion (calendar-basic-setup arg
))
105 (setq calendar-frame
(make-frame calendar-frame-parameters
))
106 (run-hooks 'calendar-after-frame-setup-hooks
)
107 (select-frame calendar-frame
)
108 (if (eq 'icon
(cdr (assoc 'visibility
109 (frame-parameters calendar-frame
))))
110 (iconify-or-deiconify-frame))
111 (display-buffer calendar-buffer
)
112 (set-window-dedicated-p (selected-window) 'calendar
)
113 (setq diary-frame
(make-frame diary-frame-parameters
))
114 (run-hooks 'calendar-after-frame-setup-hooks
)
115 (select-frame diary-frame
)
116 (if (eq 'icon
(cdr (assoc 'visibility
117 (frame-parameters diary-frame
))))
118 (iconify-or-deiconify-frame))
119 (save-excursion (diary))
120 (set-window-dedicated-p
122 (if (not (memq 'fancy-diary-display diary-display-hook
))
123 (get-file-buffer diary-file
)
124 (if (not (bufferp (get-buffer fancy-diary-buffer
)))
125 (make-fancy-diary-buffer))
129 (setq special-display-buffer-names
130 (append special-display-buffer-names
131 (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer
132 fancy-diary-buffer
(get-file-buffer diary-file
)
135 (run-hooks 'cal-x-load-hook
)
139 ;;; cal-x.el ends here