Mercurial > emacs
comparison lisp/calendar/cal-x.el @ 10088:283559c9d0ad
Initial revision
author | Edward M. Reingold <reingold@emr.cs.iit.edu> |
---|---|
date | Tue, 29 Nov 1994 15:53:55 +0000 |
parents | |
children | 0be90c288c4e |
comparison
equal
deleted
inserted
replaced
10087:20769d80bc88 | 10088:283559c9d0ad |
---|---|
1 ;;; cal-x.el --- calendar windows in dedicated frames in x-windows | |
2 | |
3 ;; Copyright (C) 1994 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | |
6 ;; Edward M. Reingold <reingold@cs.uiuc.edu> | |
7 ;; Keywords: calendar | |
8 ;; Human-Keywords: calendar, dedicated frames, x-windows | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
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) | |
15 ;; any later version. | |
16 | |
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. | |
21 | |
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. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; This collection of functions implements dedicated frames in x-windows for | |
29 ;; calendar.el. | |
30 | |
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 | |
36 | |
37 ;;; Code: | |
38 | |
39 (require 'calendar) | |
40 (if (not (fboundp 'calendar-basic-setup)) | |
41 (fset 'calendar-basic-setup (symbol-function 'calendar))) | |
42 | |
43 (defvar calendar-setup 'one-frame | |
44 "The frame set up of the calendar. | |
45 The choices are `one-frame' (calendar and diary together in one separate, | |
46 dediciated frame) or `two-frames' (calendar and diary in separate, dedicated | |
47 frames); with any other value the current frame is used.") | |
48 | |
49 (defun calendar (&optional arg) | |
50 "Choose between the one frame, two frame, or basic calendar displays. | |
51 The original function `calendar' has been renamed `calendar-basic-setup'." | |
52 (interactive "P") | |
53 (cond ((equal calendar-setup 'one-frame) (calendar-one-frame-setup arg)) | |
54 ((equal calendar-setup 'two-frames) (calendar-two-frame-setup arg)) | |
55 (t (calendar-basic-setup arg)))) | |
56 | |
57 (defvar calendar-frame nil "Frame in which to display the calendar.") | |
58 | |
59 (defvar diary-frame nil "Frame in which to display the diary.") | |
60 | |
61 (defvar diary-frame-parameters | |
62 '((name . "Diary") (height . 10) (width . 80) (unsplittable . t) | |
63 (font . "6x13") (auto-lower . t) (auto-raise . t) (minibuffer . nil)) | |
64 "Parameters of the diary frame, if the diary is in its own frame. | |
65 Location and color should be set in .Xdefaults.") | |
66 | |
67 (defvar calendar-frame-parameters | |
68 '((name . "Calendar") (minibuffer . nil) (height . 10) (width . 80) | |
69 (auto-raise . t) (auto-lower . t) (font . "6x13") (unsplittable . t) | |
70 (vertical-scroll-bars . nil)) | |
71 "Parameters of the calendar frame, if the calendar is in a separate frame. | |
72 Location and color should be set in .Xdefaults.") | |
73 | |
74 (defvar calendar-and-diary-frame-parameters | |
75 '((name . "Calendar") (height . 28) (width . 80) (minibuffer . nil) | |
76 (font . "6x13") (auto-raise . t) (auto-lower . t)) | |
77 "Parameters of the frame that displays both the calendar and the diary. | |
78 Location and color should be set in .Xdefaults.") | |
79 | |
80 (defvar calendar-after-frame-setup-hooks nil | |
81 "Hooks to be run just after setting up a calendar frame. | |
82 Can be used to change frame parameters, such as font, color, location, etc.") | |
83 | |
84 (defun calendar-one-frame-setup (&optional arg) | |
85 "Start calendar and display it in a dedicated frame together with the diary." | |
86 (if (not window-system) | |
87 (calendar-basic-setup arg) | |
88 (if (frame-live-p calendar-frame) (delete-frame calendar-frame)) | |
89 (if (frame-live-p diary-frame) (delete-frame diary-frame)) | |
90 (let ((special-display-buffer-names nil) | |
91 (view-diary-entries-initially t)) | |
92 (save-window-excursion | |
93 (save-excursion | |
94 (setq calendar-frame | |
95 (make-frame calendar-and-diary-frame-parameters)) | |
96 (run-hooks 'calendar-after-frame-setup-hooks) | |
97 (select-frame calendar-frame) | |
98 (if (eq 'icon (cdr (assoc 'visibility | |
99 (frame-parameters calendar-frame)))) | |
100 (iconify-or-deiconify-frame)) | |
101 (calendar-basic-setup arg) | |
102 (set-window-dedicated-p (selected-window) 'calendar) | |
103 (set-window-dedicated-p | |
104 (display-buffer | |
105 (if (memq 'fancy-diary-display diary-display-hook) | |
106 fancy-diary-buffer | |
107 (get-file-buffer diary-file))) | |
108 'diary)))))) | |
109 | |
110 (defun calendar-two-frame-setup (&optional arg) | |
111 "Start calendar and diary in separate, dedicated frames." | |
112 (if (not window-system) | |
113 (calendar-basic-setup arg) | |
114 (if (frame-live-p calendar-frame) (delete-frame calendar-frame)) | |
115 (if (frame-live-p diary-frame) (delete-frame diary-frame)) | |
116 (let ((pop-up-windows nil) | |
117 (view-diary-entries-initially nil) | |
118 (special-display-buffer-names nil)) | |
119 (save-window-excursion | |
120 (save-excursion (calendar-basic-setup arg)) | |
121 (setq calendar-frame (make-frame calendar-frame-parameters)) | |
122 (run-hooks 'calendar-after-frame-setup-hooks) | |
123 (select-frame calendar-frame) | |
124 (if (eq 'icon (cdr (assoc 'visibility | |
125 (frame-parameters calendar-frame)))) | |
126 (iconify-or-deiconify-frame)) | |
127 (display-buffer calendar-buffer) | |
128 (set-window-dedicated-p (selected-window) 'calendar) | |
129 (setq diary-frame (make-frame diary-frame-parameters)) | |
130 (run-hooks 'calendar-after-frame-setup-hooks) | |
131 (select-frame diary-frame) | |
132 (if (eq 'icon (cdr (assoc 'visibility | |
133 (frame-parameters diary-frame)))) | |
134 (iconify-or-deiconify-frame)) | |
135 (save-excursion (diary)) | |
136 (set-window-dedicated-p | |
137 (display-buffer | |
138 (if (memq 'fancy-diary-display diary-display-hook) | |
139 fancy-diary-buffer | |
140 (get-file-buffer diary-file))) | |
141 'diary))))) | |
142 | |
143 (setq special-display-buffer-names | |
144 (append special-display-buffer-names | |
145 (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer | |
146 fancy-diary-buffer (get-file-buffer diary-file) | |
147 calendar-buffer))) | |
148 | |
149 (run-hooks 'cal-x-load-hook) | |
150 | |
151 (provide 'cal-x) | |
152 | |
153 ;;; cal-x.el ends here |