1 ;;; cal-x.el --- calendar windows in dedicated frames in X
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 Window System
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 the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;; This collection of functions implements dedicated frames in X for
32 ;; Comments, corrections, and improvements should be sent to
33 ;; Edward M. Reingold Department of Computer Science
34 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
35 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
36 ;; Urbana, Illinois 61801
42 (defvar calendar-frame nil
"Frame in which to display the calendar.")
44 (defvar diary-frame nil
"Frame in which to display the diary.")
46 ;; This should not specify the font. That's up to the user.
47 ;; Certainly it should not specify auto-lower and auto-raise
48 ;; since most users won't like that.
49 (defvar diary-frame-parameters
50 '((name .
"Diary") (title .
"Diary") (height .
10) (width .
80)
51 (unsplittable . t
) (minibuffer . nil
))
52 "Parameters of the diary frame, if the diary is in its own frame.
53 Location and color should be set in .Xdefaults.")
55 (defvar calendar-frame-parameters
56 '((name .
"Calendar") (title .
"Calendar") (minibuffer . nil
)
57 (height .
10) (width .
80) (unsplittable . t
) (vertical-scroll-bars . nil
))
58 "Parameters of the calendar frame, if the calendar is in a separate frame.
59 Location and color should be set in .Xdefaults.")
61 (defvar calendar-and-diary-frame-parameters
62 '((name .
"Calendar") (title .
"Calendar") (height .
28) (width .
80)
64 "Parameters of the frame that displays both the calendar and the diary.
65 Location and color should be set in .Xdefaults.")
67 (defvar calendar-after-frame-setup-hooks nil
68 "Hooks to be run just after setting up a calendar frame.
69 Can be used to change frame parameters, such as font, color, location, etc.")
71 (defun calendar-one-frame-setup (&optional arg
)
72 "Start calendar and display it in a dedicated frame together with the diary."
73 (if (not (display-multi-frame-p))
74 (calendar-basic-setup arg
)
75 (if (frame-live-p calendar-frame
) (delete-frame calendar-frame
))
76 (if (frame-live-p diary-frame
) (delete-frame diary-frame
))
77 (let ((special-display-buffer-names nil
)
78 (view-diary-entries-initially t
))
79 (save-window-excursion
82 (make-frame calendar-and-diary-frame-parameters
))
83 (run-hooks 'calendar-after-frame-setup-hooks
)
84 (select-frame calendar-frame
)
85 (if (eq 'icon
(cdr (assoc 'visibility
86 (frame-parameters calendar-frame
))))
87 (iconify-or-deiconify-frame))
88 (calendar-basic-setup arg
)
89 (set-window-dedicated-p (selected-window) 'calendar
)
90 (set-window-dedicated-p
92 (if (not (memq 'fancy-diary-display diary-display-hook
))
93 (get-file-buffer diary-file
)
94 (if (not (bufferp (get-buffer fancy-diary-buffer
)))
95 (make-fancy-diary-buffer))
99 (defun calendar-only-one-frame-setup (&optional arg
)
100 "Start calendar and display it in a dedicated frame."
101 (if (not (display-multi-frame-p))
102 (calendar-basic-setup arg
)
103 (if (frame-live-p calendar-frame
) (delete-frame calendar-frame
))
104 (let ((special-display-buffer-names nil
)
105 (view-diary-entries-initially nil
))
106 (save-window-excursion
109 (make-frame calendar-frame-parameters
))
110 (run-hooks 'calendar-after-frame-setup-hooks
)
111 (select-frame calendar-frame
)
112 (if (eq 'icon
(cdr (assoc 'visibility
113 (frame-parameters calendar-frame
))))
114 (iconify-or-deiconify-frame))
115 (calendar-basic-setup arg
)
116 (set-window-dedicated-p (selected-window) 'calendar
))))))
118 (defun calendar-two-frame-setup (&optional arg
)
119 "Start calendar and diary in separate, dedicated frames."
120 (if (not (display-multi-frame-p))
121 (calendar-basic-setup arg
)
122 (if (frame-live-p calendar-frame
) (delete-frame calendar-frame
))
123 (if (frame-live-p diary-frame
) (delete-frame diary-frame
))
124 (let ((pop-up-windows nil
)
125 (view-diary-entries-initially nil
)
126 (special-display-buffer-names nil
))
127 (save-window-excursion
128 (save-excursion (calendar-basic-setup arg
))
129 (setq calendar-frame
(make-frame calendar-frame-parameters
))
130 (run-hooks 'calendar-after-frame-setup-hooks
)
131 (select-frame calendar-frame
)
132 (if (eq 'icon
(cdr (assoc 'visibility
133 (frame-parameters calendar-frame
))))
134 (iconify-or-deiconify-frame))
135 (display-buffer calendar-buffer
)
136 (set-window-dedicated-p (selected-window) 'calendar
)
137 (setq diary-frame
(make-frame diary-frame-parameters
))
138 (run-hooks 'calendar-after-frame-setup-hooks
)
139 (select-frame diary-frame
)
140 (if (eq 'icon
(cdr (assoc 'visibility
141 (frame-parameters diary-frame
))))
142 (iconify-or-deiconify-frame))
143 (save-excursion (diary))
144 (set-window-dedicated-p
146 (if (not (memq 'fancy-diary-display diary-display-hook
))
147 (get-file-buffer diary-file
)
148 (if (not (bufferp (get-buffer fancy-diary-buffer
)))
149 (make-fancy-diary-buffer))
153 ;; Formerly (get-file-buffer diary-file) was added to the list here,
154 ;; but that isn't clean, and the value could even be nil.
155 (setq special-display-buffer-names
156 (append special-display-buffer-names
157 (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer
159 other-calendars-buffer calendar-buffer
)))
161 (run-hooks 'cal-x-load-hook
)
165 ;;; cal-x.el ends here