Mercurial > emacs
annotate lisp/calendar/cal-x.el @ 78076:dc2000c17cdd
*** empty log message ***
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sat, 07 Jul 2007 03:01:31 +0000 |
parents | 345c5cf4990e |
children | 93e11478c954 f8b17fd6cf74 e6fdae9180d4 |
rev | line source |
---|---|
14269
af156af979be
Fix doc strings at top of file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14169
diff
changeset
|
1 ;;; cal-x.el --- calendar windows in dedicated frames in X |
10088 | 2 |
75346 | 3 ;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
10088 | 5 |
6 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | |
7 ;; Edward M. Reingold <reingold@cs.uiuc.edu> | |
65919
5c09efcfc1d9
Update maintainer email address.
Glenn Morris <rgm@gnu.org>
parents:
64085
diff
changeset
|
8 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
10088 | 9 ;; Keywords: calendar |
14269
af156af979be
Fix doc strings at top of file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14169
diff
changeset
|
10 ;; Human-Keywords: calendar, dedicated frames, X Window System |
10088 | 11 |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
16 ;; the Free Software Foundation; either version 2, or (at your option) | |
17 ;; any later version. | |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
10088 | 28 |
29 ;;; Commentary: | |
30 | |
14269
af156af979be
Fix doc strings at top of file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14169
diff
changeset
|
31 ;; This collection of functions implements dedicated frames in X for |
10088 | 32 ;; calendar.el. |
33 | |
34 ;;; Code: | |
35 | |
13441 | 36 (require 'calendar) |
37 | |
10088 | 38 (defvar calendar-frame nil "Frame in which to display the calendar.") |
39 | |
40 (defvar diary-frame nil "Frame in which to display the diary.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
37431
diff
changeset
|
41 |
15114
2151ff2428aa
(diary-frame-parameters, calendar-frame-parameters)
Richard M. Stallman <rms@gnu.org>
parents:
14269
diff
changeset
|
42 ;; This should not specify the font. That's up to the user. |
2151ff2428aa
(diary-frame-parameters, calendar-frame-parameters)
Richard M. Stallman <rms@gnu.org>
parents:
14269
diff
changeset
|
43 ;; Certainly it should not specify auto-lower and auto-raise |
2151ff2428aa
(diary-frame-parameters, calendar-frame-parameters)
Richard M. Stallman <rms@gnu.org>
parents:
14269
diff
changeset
|
44 ;; since most users won't like that. |
10088 | 45 (defvar diary-frame-parameters |
23552
905aab3037e8
Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
22262
diff
changeset
|
46 '((name . "Diary") (title . "Diary") (height . 10) (width . 80) |
905aab3037e8
Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
22262
diff
changeset
|
47 (unsplittable . t) (minibuffer . nil)) |
10088 | 48 "Parameters of the diary frame, if the diary is in its own frame. |
49 Location and color should be set in .Xdefaults.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
37431
diff
changeset
|
50 |
10088 | 51 (defvar calendar-frame-parameters |
23552
905aab3037e8
Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
22262
diff
changeset
|
52 '((name . "Calendar") (title . "Calendar") (minibuffer . nil) |
905aab3037e8
Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
22262
diff
changeset
|
53 (height . 10) (width . 80) (unsplittable . t) (vertical-scroll-bars . nil)) |
10088 | 54 "Parameters of the calendar frame, if the calendar is in a separate frame. |
55 Location and color should be set in .Xdefaults.") | |
56 | |
57 (defvar calendar-and-diary-frame-parameters | |
23552
905aab3037e8
Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
22262
diff
changeset
|
58 '((name . "Calendar") (title . "Calendar") (height . 28) (width . 80) |
905aab3037e8
Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
22262
diff
changeset
|
59 (minibuffer . nil)) |
10088 | 60 "Parameters of the frame that displays both the calendar and the diary. |
61 Location and color should be set in .Xdefaults.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
37431
diff
changeset
|
62 |
10088 | 63 (defvar calendar-after-frame-setup-hooks nil |
64 "Hooks to be run just after setting up a calendar frame. | |
65 Can be used to change frame parameters, such as font, color, location, etc.") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
37431
diff
changeset
|
66 |
10088 | 67 (defun calendar-one-frame-setup (&optional arg) |
53558 | 68 "Start calendar and display it in a dedicated frame together with the diary. |
69 This function requires a display capable of multiple frames, else | |
70 `calendar-basic-setup' is used instead." | |
37431
bd1a8b1c88d7
(calendar-two-frame-setup, calendar-only-one-frame-setup)
Eli Zaretskii <eliz@gnu.org>
parents:
24890
diff
changeset
|
71 (if (not (display-multi-frame-p)) |
10088 | 72 (calendar-basic-setup arg) |
73 (if (frame-live-p calendar-frame) (delete-frame calendar-frame)) | |
74 (if (frame-live-p diary-frame) (delete-frame diary-frame)) | |
75 (let ((special-display-buffer-names nil) | |
76 (view-diary-entries-initially t)) | |
77 (save-window-excursion | |
78 (save-excursion | |
79 (setq calendar-frame | |
80 (make-frame calendar-and-diary-frame-parameters)) | |
81 (run-hooks 'calendar-after-frame-setup-hooks) | |
82 (select-frame calendar-frame) | |
83 (if (eq 'icon (cdr (assoc 'visibility | |
84 (frame-parameters calendar-frame)))) | |
85 (iconify-or-deiconify-frame)) | |
86 (calendar-basic-setup arg) | |
61142
1b5d0d3282a7
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
53558
diff
changeset
|
87 (set-window-dedicated-p (selected-window) t) |
10088 | 88 (set-window-dedicated-p |
89 (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>
parents:
12049
diff
changeset
|
90 (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>
parents:
12049
diff
changeset
|
91 (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>
parents:
12049
diff
changeset
|
92 (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>
parents:
12049
diff
changeset
|
93 (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>
parents:
12049
diff
changeset
|
94 fancy-diary-buffer)) |
61142
1b5d0d3282a7
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
53558
diff
changeset
|
95 t)))))) |
12060
b163768a998f
Fix cal-x.el to create an empty fancy-diary-buffer, if needed.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
12049
diff
changeset
|
96 |
24890
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
97 (defun calendar-only-one-frame-setup (&optional arg) |
53558 | 98 "Start calendar and display it in a dedicated frame. |
99 This function requires a display capable of multiple frames, else | |
100 `calendar-basic-setup' is used instead." | |
37431
bd1a8b1c88d7
(calendar-two-frame-setup, calendar-only-one-frame-setup)
Eli Zaretskii <eliz@gnu.org>
parents:
24890
diff
changeset
|
101 (if (not (display-multi-frame-p)) |
24890
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
102 (calendar-basic-setup arg) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
103 (if (frame-live-p calendar-frame) (delete-frame calendar-frame)) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
104 (let ((special-display-buffer-names nil) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
105 (view-diary-entries-initially nil)) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
106 (save-window-excursion |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
107 (save-excursion |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
108 (setq calendar-frame |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
109 (make-frame calendar-frame-parameters)) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
110 (run-hooks 'calendar-after-frame-setup-hooks) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
111 (select-frame calendar-frame) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
112 (if (eq 'icon (cdr (assoc 'visibility |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
113 (frame-parameters calendar-frame)))) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
114 (iconify-or-deiconify-frame)) |
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
115 (calendar-basic-setup arg) |
61142
1b5d0d3282a7
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
53558
diff
changeset
|
116 (set-window-dedicated-p (selected-window) t)))))) |
24890
5f37b93c8538
(calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents:
24860
diff
changeset
|
117 |
10088 | 118 (defun calendar-two-frame-setup (&optional arg) |
53558 | 119 "Start calendar and diary in separate, dedicated frames. |
120 This function requires a display capable of multiple frames, else | |
121 `calendar-basic-setup' is used instead." | |
37431
bd1a8b1c88d7
(calendar-two-frame-setup, calendar-only-one-frame-setup)
Eli Zaretskii <eliz@gnu.org>
parents:
24890
diff
changeset
|
122 (if (not (display-multi-frame-p)) |
10088 | 123 (calendar-basic-setup arg) |
124 (if (frame-live-p calendar-frame) (delete-frame calendar-frame)) | |
125 (if (frame-live-p diary-frame) (delete-frame diary-frame)) | |
126 (let ((pop-up-windows nil) | |
127 (view-diary-entries-initially nil) | |
128 (special-display-buffer-names nil)) | |
129 (save-window-excursion | |
130 (save-excursion (calendar-basic-setup arg)) | |
131 (setq calendar-frame (make-frame calendar-frame-parameters)) | |
132 (run-hooks 'calendar-after-frame-setup-hooks) | |
133 (select-frame calendar-frame) | |
134 (if (eq 'icon (cdr (assoc 'visibility | |
135 (frame-parameters calendar-frame)))) | |
136 (iconify-or-deiconify-frame)) | |
137 (display-buffer calendar-buffer) | |
61142
1b5d0d3282a7
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
53558
diff
changeset
|
138 (set-window-dedicated-p (selected-window) t) |
10088 | 139 (setq diary-frame (make-frame diary-frame-parameters)) |
140 (run-hooks 'calendar-after-frame-setup-hooks) | |
141 (select-frame diary-frame) | |
142 (if (eq 'icon (cdr (assoc 'visibility | |
143 (frame-parameters diary-frame)))) | |
144 (iconify-or-deiconify-frame)) | |
145 (save-excursion (diary)) | |
146 (set-window-dedicated-p | |
147 (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>
parents:
12049
diff
changeset
|
148 (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>
parents:
12049
diff
changeset
|
149 (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>
parents:
12049
diff
changeset
|
150 (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>
parents:
12049
diff
changeset
|
151 (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>
parents:
12049
diff
changeset
|
152 fancy-diary-buffer)) |
61142
1b5d0d3282a7
Update copyright and maintainer.
Glenn Morris <rgm@gnu.org>
parents:
53558
diff
changeset
|
153 t))))) |
10088 | 154 |
24860
069cad4a56ef
(special-display-buffer-names):
Karl Heuer <kwzh@gnu.org>
parents:
23552
diff
changeset
|
155 ;; Formerly (get-file-buffer diary-file) was added to the list here, |
069cad4a56ef
(special-display-buffer-names):
Karl Heuer <kwzh@gnu.org>
parents:
23552
diff
changeset
|
156 ;; but that isn't clean, and the value could even be nil. |
10088 | 157 (setq special-display-buffer-names |
158 (append special-display-buffer-names | |
159 (list "*Yahrzeits*" lunar-phases-buffer holiday-buffer | |
24860
069cad4a56ef
(special-display-buffer-names):
Karl Heuer <kwzh@gnu.org>
parents:
23552
diff
changeset
|
160 fancy-diary-buffer |
22262
ac47a12e523c
Fix list of "special" buffers.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
15114
diff
changeset
|
161 other-calendars-buffer calendar-buffer))) |
10088 | 162 |
163 (run-hooks 'cal-x-load-hook) | |
164 | |
165 (provide 'cal-x) | |
166 | |
52401 | 167 ;;; arch-tag: c6dbddca-ae84-442d-87fc-244b76e38e17 |
10088 | 168 ;;; cal-x.el ends here |