annotate lisp/calendar/cal-x.el @ 93258:16142d1d9f33

(redisplay_internal): Reset selected_frame earlier.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 26 Mar 2008 18:11:47 +0000
parents 41e41843fac2
children a4a2b2f63116
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
2
92623
fce91e69b8d6 (calendar-frame-parameters, calendar-and-diary-frame-parameters): Fix
Glenn Morris <rgm@gnu.org>
parents: 92605
diff changeset
3 ;; Copyright (C) 1994, 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
fce91e69b8d6 (calendar-frame-parameters, calendar-and-diary-frame-parameters): Fix
Glenn Morris <rgm@gnu.org>
parents: 92605
diff changeset
4 ;; 2008 Free Software Foundation, Inc.
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
5
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
6 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
92857
ab9ec247b4ff Whitespace only.
Glenn Morris <rgm@gnu.org>
parents: 92839
diff changeset
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
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
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
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
11
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
13
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
78216
93e11478c954 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 77279
diff changeset
16 ;; the Free Software Foundation; either version 3, or (at your option)
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
17 ;; any later version.
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
18
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
22 ;; GNU General Public License for more details.
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
23
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13441
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 61142
diff changeset
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 61142
diff changeset
27 ;; Boston, MA 02110-1301, USA.
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
28
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
29 ;;; Commentary:
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
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
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
32 ;; calendar.el.
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
33
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
34 ;;; Code:
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
35
13441
3d2e58f4385f Require calendar.
Richard M. Stallman <rms@gnu.org>
parents: 13046
diff changeset
36 (require 'calendar)
3d2e58f4385f Require calendar.
Richard M. Stallman <rms@gnu.org>
parents: 13046
diff changeset
37
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
38 (defcustom diary-frame-parameters
23552
905aab3037e8 Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22262
diff changeset
39 '((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
40 (unsplittable . t) (minibuffer . nil))
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
41 "Parameters of the diary frame, if the diary is in its own frame.
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
42 Relevant if `calendar-setup' has the value `two-frames'."
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
43 :type 'alist
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
44 :options '((name string) (title string) (height integer) (width integer)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
45 (unsplittable boolean) (minibuffer boolean)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
46 (vertical-scroll-bars boolean))
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
47 :group 'calendar)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 37431
diff changeset
48
92623
fce91e69b8d6 (calendar-frame-parameters, calendar-and-diary-frame-parameters): Fix
Glenn Morris <rgm@gnu.org>
parents: 92605
diff changeset
49 (defcustom calendar-frame-parameters
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
50 '((name . "Calendar") (title . "Calendar") (height . 10) (width . 80)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
51 (unsplittable . t) (minibuffer . nil) (vertical-scroll-bars . nil))
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
52 "Parameters of the calendar frame, if the calendar is in a separate frame.
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
53 Relevant if `calendar-setup' has the value `calendar-only' or `two-frames'."
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
54 :type 'alist
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
55 :options '((name string) (title string) (height integer) (width integer)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
56 (unsplittable boolean) (minibuffer boolean)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
57 (vertical-scroll-bars boolean))
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
58 :group 'calendar)
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
59
92623
fce91e69b8d6 (calendar-frame-parameters, calendar-and-diary-frame-parameters): Fix
Glenn Morris <rgm@gnu.org>
parents: 92605
diff changeset
60 (defcustom calendar-and-diary-frame-parameters
23552
905aab3037e8 Add title parameters to frames.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents: 22262
diff changeset
61 '((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
62 (minibuffer . nil))
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
63 "Parameters of the frame that displays both the calendar and the diary.
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
64 Relevant if `calendar-setup' has the value `one-frame'."
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
65 :type 'alist
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
66 :options '((name string) (title string) (height integer) (width integer)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
67 (unsplittable boolean) (minibuffer boolean)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
68 (vertical-scroll-bars boolean))
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
69 :group 'calendar)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 37431
diff changeset
70
93226
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
71 (defcustom calendar-after-frame-setup-hook nil
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
72 "List of functions to be run after creating a calendar and/or diary frame."
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
73 :type 'hook
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
74 :group 'calendar-hooks)
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
75
93226
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
76 (define-obsolete-variable-alias 'calendar-after-frame-setup-hooks
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
77 'calendar-after-frame-setup-hook "23.1")
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
78
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
79 ;;; End of user options.
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
80
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
81 (defvar calendar-frame nil
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
82 "Frame in which the calendar was last displayed.")
92605
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
83
5fb3b5d72071 (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92593
diff changeset
84 (defvar diary-frame nil
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
85 "Frame in which the diary was last displayed.")
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
86
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
87 (defun calendar-frame-1 (frame)
93226
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
88 "Subroutine used by `calendar-frame-setup'.
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
89 Runs `calendar-after-frame-setup-hook', selects frame, iconifies if needed."
41e41843fac2 (calendar-after-frame-setup-hook): New name for
Glenn Morris <rgm@gnu.org>
parents: 93193
diff changeset
90 (run-hooks 'calendar-after-frame-setup-hook)
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
91 (select-frame frame)
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
92 (if (eq 'icon (cdr (assoc 'visibility (frame-parameters frame))))
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
93 (iconify-or-deiconify-frame)))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 37431
diff changeset
94
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
95 (defun calendar-dedicate-diary ()
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
96 "Display and dedicate the window associated with the diary buffer."
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
97 (set-window-dedicated-p
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
98 (display-buffer
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
99 (if (not (memq 'fancy-diary-display diary-display-hook))
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
100 (get-file-buffer diary-file)
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
101 ;; If there are no diary entries, there won't be a fancy-diary
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
102 ;; to dedicate, so make a basic one.
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
103 (or (buffer-live-p fancy-diary-buffer)
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
104 (calendar-in-read-only-buffer fancy-diary-buffer
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
105 (calendar-set-mode-line "Diary Entries")))
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
106 fancy-diary-buffer))
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
107 t))
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
108
92839
2daf404f568f (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92821
diff changeset
109 ;;;###cal-autoload
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
110 (defun calendar-frame-setup (config &optional prompt)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
111 "Display the calendar, and optionally the diary, in a separate frame.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
112 CONFIG should be one of:
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
113 `calendar-only' - just the calendar, no diary
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
114 `one-frame' - calendar and diary in a single frame
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
115 `two-frames' - calendar and diary each in a separate frame
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
116
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
117 If CONFIG has any other value, or if the display is not capable of
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
118 multiple frames, then `calendar-basic-setup' is called.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
119
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
120 If PROMPT is non-nil, prompt for the month and year to use."
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
121 (if (not (and (display-multi-frame-p)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
122 (memq config '(calendar-only one-frame two-frames))))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
123 (calendar-basic-setup prompt)
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
124 (if (frame-live-p calendar-frame) (delete-frame calendar-frame))
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
125 (unless (eq config 'calendar-only)
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
126 (if (frame-live-p diary-frame) (delete-frame diary-frame)))
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
127 (let ((view-diary-entries-initially (eq config 'one-frame))
93193
280935cd7ea9 Comment.
Glenn Morris <rgm@gnu.org>
parents: 93191
diff changeset
128 ;; For calendar-dedicate-diary in two-frames case.
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
129 (pop-up-windows nil))
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
130 (save-window-excursion
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
131 ;; Do diary first so that calendar is always left current.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
132 (when (eq config 'two-frames)
93028
531ac371602f (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 92857
diff changeset
133 (calendar-frame-1
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
134 (setq diary-frame (make-frame diary-frame-parameters)))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
135 (diary)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
136 (calendar-dedicate-diary))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
137 (calendar-frame-1
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
138 (setq calendar-frame
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
139 (make-frame (if (eq config 'one-frame)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
140 calendar-and-diary-frame-parameters
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
141 calendar-frame-parameters))))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
142 (calendar-basic-setup prompt (not (eq config 'one-frame)))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
143 (set-window-buffer (selected-window) calendar-buffer)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
144 (set-window-dedicated-p (selected-window) t)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
145 (if (eq config 'one-frame)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
146 (calendar-dedicate-diary))))))
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
147
24890
5f37b93c8538 (calendar-only-one-frame-setup): New function.
Karl Heuer <kwzh@gnu.org>
parents: 24860
diff changeset
148
92839
2daf404f568f (generated-autoload-file): Don't set, instead use different values of
Glenn Morris <rgm@gnu.org>
parents: 92821
diff changeset
149 ;;;###cal-autoload
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
150 (defun calendar-one-frame-setup (&optional prompt)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
151 "Display calendar and diary in a single dedicated frame.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
152 See `calendar-frame-setup' for more information."
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
153 (calendar-frame-setup 'one-frame prompt))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
154
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
155 (make-obsolete 'calendar-one-frame-setup 'calendar-frame-setup "23.1")
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
156
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
157
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
158 ;;;###cal-autoload
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
159 (defun calendar-only-one-frame-setup (&optional prompt)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
160 "Display calendar in a dedicated frame.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
161 See `calendar-frame-setup' for more information."
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
162 (calendar-frame-setup 'calendar-only prompt))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
163
93193
280935cd7ea9 Comment.
Glenn Morris <rgm@gnu.org>
parents: 93191
diff changeset
164 (make-obsolete 'calendar-only-one-frame-setup 'calendar-frame-setup "23.1")
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
165
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
166
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
167 ;;;###cal-autoload
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
168 (defun calendar-two-frame-setup (&optional prompt)
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
169 "Display calendar and diary in separate, dedicated frames.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
170 See `calendar-frame-setup' for more information."
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
171 (calendar-frame-setup 'two-frames prompt))
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
172
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
173 (make-obsolete 'calendar-two-frame-setup 'calendar-frame-setup "23.1")
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
174
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
175
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
176 ;; Undocumented and probably useless.
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
177 (defvar cal-x-load-hook nil
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
178 "Hook run on loading of the `cal-x' package.")
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
179 (make-obsolete-variable 'cal-x-load-hook "it will be removed in future." "23.1")
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
180
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
181 (run-hooks 'cal-x-load-hook)
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
182
93188
bb7e96e383ab (diary-frame-parameters, calendar-frame-parameters)
Glenn Morris <rgm@gnu.org>
parents: 93028
diff changeset
183
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
184 (provide 'cal-x)
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
185
82116
f8b17fd6cf74 Trivial comment style change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 77279
diff changeset
186 ;; arch-tag: c6dbddca-ae84-442d-87fc-244b76e38e17
10088
283559c9d0ad Initial revision
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
diff changeset
187 ;;; cal-x.el ends here