10088
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
1 ;;; cal-x.el --- calendar windows in dedicated frames in x-windows
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
2
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
4
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
6 ;; Edward M. Reingold <reingold@cs.uiuc.edu>
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
7 ;; Keywords: calendar
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
8 ;; Human-Keywords: calendar, dedicated frames, x-windows
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
9
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
11
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
15 ;; any later version.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
16
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful,
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
21
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
25
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
26 ;;; Commentary:
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
27
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
28 ;; This collection of functions implements dedicated frames in x-windows for
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
29 ;; calendar.el.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
30
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
31 ;; Comments, corrections, and improvements should be sent to
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
32 ;; Edward M. Reingold Department of Computer Science
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
33 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
34 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
35 ;; Urbana, Illinois 61801
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
36
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
37 ;;; Code:
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
38
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
39 (require 'calendar)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
40 (if (not (fboundp 'calendar-basic-setup))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
41 (fset 'calendar-basic-setup (symbol-function 'calendar)))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
42
|
12049
|
43 ;;;###autoload
|
10088
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
44 (defvar calendar-setup 'one-frame
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
45 "The frame set up of the calendar.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
46 The choices are `one-frame' (calendar and diary together in one separate,
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
47 dediciated frame) or `two-frames' (calendar and diary in separate, dedicated
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
48 frames); with any other value the current frame is used.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
49
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
50 (defun calendar (&optional arg)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
51 "Choose between the one frame, two frame, or basic calendar displays.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
52 The original function `calendar' has been renamed `calendar-basic-setup'."
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
53 (interactive "P")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
54 (cond ((equal calendar-setup 'one-frame) (calendar-one-frame-setup arg))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
55 ((equal calendar-setup 'two-frames) (calendar-two-frame-setup arg))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
56 (t (calendar-basic-setup arg))))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
57
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
58 (defvar calendar-frame nil "Frame in which to display the calendar.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
59
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
60 (defvar diary-frame nil "Frame in which to display the diary.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
61
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
62 (defvar diary-frame-parameters
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
63 '((name . "Diary") (height . 10) (width . 80) (unsplittable . t)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
64 (font . "6x13") (auto-lower . t) (auto-raise . t) (minibuffer . nil))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
65 "Parameters of the diary frame, if the diary is in its own frame.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
66 Location and color should be set in .Xdefaults.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
67
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
68 (defvar calendar-frame-parameters
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
69 '((name . "Calendar") (minibuffer . nil) (height . 10) (width . 80)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
70 (auto-raise . t) (auto-lower . t) (font . "6x13") (unsplittable . t)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
71 (vertical-scroll-bars . nil))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
72 "Parameters of the calendar frame, if the calendar is in a separate frame.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
73 Location and color should be set in .Xdefaults.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
74
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
75 (defvar calendar-and-diary-frame-parameters
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
76 '((name . "Calendar") (height . 28) (width . 80) (minibuffer . nil)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
77 (font . "6x13") (auto-raise . t) (auto-lower . t))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
78 "Parameters of the frame that displays both the calendar and the diary.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
79 Location and color should be set in .Xdefaults.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
80
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
81 (defvar calendar-after-frame-setup-hooks nil
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
82 "Hooks to be run just after setting up a calendar frame.
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
83 Can be used to change frame parameters, such as font, color, location, etc.")
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
84
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
85 (defun calendar-one-frame-setup (&optional arg)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
86 "Start calendar and display it in a dedicated frame together with the diary."
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
87 (if (not window-system)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
88 (calendar-basic-setup arg)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
89 (if (frame-live-p calendar-frame) (delete-frame calendar-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
90 (if (frame-live-p diary-frame) (delete-frame diary-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
91 (let ((special-display-buffer-names nil)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
92 (view-diary-entries-initially t))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
93 (save-window-excursion
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
94 (save-excursion
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
95 (setq calendar-frame
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
96 (make-frame calendar-and-diary-frame-parameters))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
97 (run-hooks 'calendar-after-frame-setup-hooks)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
98 (select-frame calendar-frame)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
99 (if (eq 'icon (cdr (assoc 'visibility
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
100 (frame-parameters calendar-frame))))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
101 (iconify-or-deiconify-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
102 (calendar-basic-setup arg)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
103 (set-window-dedicated-p (selected-window) 'calendar)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
104 (set-window-dedicated-p
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
105 (display-buffer
|
12060
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
106 (if (not (memq 'fancy-diary-display diary-display-hook))
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
107 (get-file-buffer diary-file)
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
108 (if (not (bufferp (get-buffer fancy-diary-buffer)))
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
109 (make-fancy-diary-buffer))
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
110 fancy-diary-buffer))
|
10088
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
111 'diary))))))
|
12060
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
112
|
10088
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
113 (defun calendar-two-frame-setup (&optional arg)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
114 "Start calendar and diary in separate, dedicated frames."
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
115 (if (not window-system)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
116 (calendar-basic-setup arg)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
117 (if (frame-live-p calendar-frame) (delete-frame calendar-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
118 (if (frame-live-p diary-frame) (delete-frame diary-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
119 (let ((pop-up-windows nil)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
120 (view-diary-entries-initially nil)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
121 (special-display-buffer-names nil))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
122 (save-window-excursion
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
123 (save-excursion (calendar-basic-setup arg))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
124 (setq calendar-frame (make-frame calendar-frame-parameters))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
125 (run-hooks 'calendar-after-frame-setup-hooks)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
126 (select-frame calendar-frame)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
127 (if (eq 'icon (cdr (assoc 'visibility
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
128 (frame-parameters calendar-frame))))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
129 (iconify-or-deiconify-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
130 (display-buffer calendar-buffer)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
131 (set-window-dedicated-p (selected-window) 'calendar)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
132 (setq diary-frame (make-frame diary-frame-parameters))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
133 (run-hooks 'calendar-after-frame-setup-hooks)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
134 (select-frame diary-frame)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
135 (if (eq 'icon (cdr (assoc 'visibility
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
136 (frame-parameters diary-frame))))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
137 (iconify-or-deiconify-frame))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
138 (save-excursion (diary))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
139 (set-window-dedicated-p
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
140 (display-buffer
|
12060
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
141 (if (not (memq 'fancy-diary-display diary-display-hook))
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
142 (get-file-buffer diary-file)
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
143 (if (not (bufferp (get-buffer fancy-diary-buffer)))
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
144 (make-fancy-diary-buffer))
|
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
diff
changeset
|
145 fancy-diary-buffer))
|
10088
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
146 'diary)))))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
147
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
148 (setq special-display-buffer-names
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
149 (append special-display-buffer-names
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
150 (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
151 fancy-diary-buffer (get-file-buffer diary-file)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
152 calendar-buffer)))
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
153
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
154 (run-hooks 'cal-x-load-hook)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
155
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
156 (provide 'cal-x)
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
157
|
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff
changeset
|
158 ;;; cal-x.el ends here
|