annotate lisp/calendar/appt.el @ 2354:dcc756fba34f

* xterm.h (x_focus_frame): Add extern keyword to declaration.
author Jim Blandy <jimb@redhat.com>
date Thu, 25 Mar 1993 02:12:14 +0000
parents 2619b7a9c11e
children c7badee38b64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 179
diff changeset
1 ;;; appt.el --- appointment notification functions.
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 179
diff changeset
2
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
3 ;; Copyright (C) 1989, 1990 Free Software Foundation, Inc.
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
4
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
5 ;; Author: Neil Mager <neilm@juliet.ll.mit.edu>
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
6 ;; Version: 2.1
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
7 ;; Keywords: calendar
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
8
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 ;; any later version.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
25 ;;; Commentary:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
26
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;; appt.el - visible and/or audible notification of
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; appointments from ~/diary file generated from
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;; Edward M. Reingold's calendar.el.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;; Comments, corrections, and improvements should be sent to
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;; Neil M. Mager
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; Net <neilm@juliet.ll.mit.edu>
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; Voice (617) 981-4803
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ;;; Thanks to Edward M. Reingold for much help and many suggestions,
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ;;; And to many others for bug fixes and suggestions.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ;;; This functions in this file will alert the user of a
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 ;;; pending appointment based on their diary file.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ;;; ******* It is necessary to invoke 'display-time' ********
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 ;;; ******* and 'diary' for this to work properly. ********
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;;; A message will be displayed in the mode line of the emacs buffer
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 ;;; and (if the user desires) the terminal will beep and display a message
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 ;;; from the diary in the mini-buffer, or the user may select to
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 ;;; have a message displayed in a new buffer.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 ;;; The variable 'appt-message-warning-time' allows the
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 ;;; user to specify how much notice they want before the appointment. The
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 ;;; variable 'appt-issue-message' specifies whether the user wants
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 ;;; to to be notified of a pending appointment.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 ;;; In order to use, the following should be in your .emacs file in addition to
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 ;;; creating a diary file and invoking calendar:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 ;;; Set some options
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 ;;; (setq view-diary-entries-initially t)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 ;;; (setq appt-issue-message t)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 ;;; The following three lines are required:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 ;;; (display-time)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 ;;; (autoload 'appt-make-list "appt.el" nil t)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 ;;; (setq diary-display-hook
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 ;;; (list 'appt-make-list 'prepare-fancy-diary-buffer))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 ;;; This is an example of what can be in your diary file:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 ;;; Monday
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 ;;; 9:30am Coffee break
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 ;;; 12:00pm Lunch
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 ;;; Based upon the above lines in your .emacs and diary files,
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 ;;; the calendar and diary will be displayed when you enter
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 ;;; emacs and your appointments list will automatically be created.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 ;;; You will then be reminded at 9:20am about your coffee break
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 ;;; and at 11:50am to go to lunch.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 ;;; Use describe-function on appt-check for a description of other variables
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 ;;; that can be used to personalize the notification system.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 ;;; In order to add or delete items from todays list, use appt-add
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 ;;; and appt-delete.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 ;;; Additionally, the appointments list is recreated automatically
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 ;;; at 12:01am for those who do not logout every day or are programming
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 ;;; late.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 ;;; Brief internal description - Skip this if your not interested!
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 ;;; The function appt-check is run from the 'loadst' process which is started
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 ;;; by invoking (display-time). A temporary function below modifies
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 ;;; display-time-filter
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 ;;; (from original time.el) to include a hook which will invoke appt-check.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 ;;; This will not be necessary in the next version of gnuemacs.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 ;;; The function appt-make-list creates the appointments list which appt-check
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 ;;; reads. This is all done automatically.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 ;;; It is invoked from the function list-diary-entries.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 ;;;
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
107
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
108 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
109
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
110 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (defvar appt-issue-message t
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 "*Non-nil means check for appointments in the diary buffer.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 To be detected, the diary entry must have the time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 as the first thing on a line.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
116 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (defvar appt-message-warning-time 10
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 "*Time in minutes before an appointment that the warning begins.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
120 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (defvar appt-audible t
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 "*Non-nil means beep to indicate appointment.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
124 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (defvar appt-visible t
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 "*Non-nil means display appointment message in echo area.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
128 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 (defvar appt-display-mode-line t
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 "*Non-nil means display minutes to appointment and time on the mode line.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
132 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 (defvar appt-msg-window t
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 "*Non-nil means display appointment message in another window.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
136 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 (defvar appt-display-duration 5
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 "*The number of seconds an appointment message is displayed.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
140 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (defvar appt-display-diary t
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 "*Non-nil means to display the next days diary on the screen.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 This will occur at midnight when the appointment list is updated.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (defvar appt-time-msg-list nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 "The list of appointments for today.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 Use `appt-add' and `appt-delete' to add and delete appointments from list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 The original list is generated from the today's `diary-entries-list'.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 The number before each time/message is the time in minutes from midnight.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 (defconst max-time 1439
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 "11:59pm in minutes - number of minutes in a day minus 1.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 (defun appt-check ()
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 "Check for an appointment and update the mode line.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 Note: the time must be the first thing in the line in the diary
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 for a warning to be issued.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 The format of the time can be either 24 hour or am/pm.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 Example:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 02/23/89
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 18:00 Dinner
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 Thursday
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 11:45am Lunch meeting.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 The following variables control the action of the notification:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 appt-issue-message
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 If T, the diary buffer is checked for appointments.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 appt-message-warning-time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 Variable used to determine if appointment message
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 should be displayed.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 appt-audible
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 Variable used to determine if appointment is audible.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 Default is t.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 appt-visible
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 Variable used to determine if appointment message should be
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 displayed in the mini-buffer. Default is t.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 appt-msg-window
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 Variable used to determine if appointment message
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 should temporarily appear in another window. Mutually exclusive
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 to appt-visible.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 appt-display-duration
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 The number of seconds an appointment message
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 is displayed in another window.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 This function is run from the loadst process for display time.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 Therefore, you need to have `(display-time)' in your .emacs file."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 (let ((min-to-app -1)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (new-time ""))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (save-excursion
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 ;; Get the current time and convert it to minutes
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 ;; from midnight. ie. 12:01am = 1, midnight = 0.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (let* ((cur-hour(string-to-int
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 (substring (current-time-string) 11 13)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (cur-min (string-to-int
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (substring (current-time-string) 14 16)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 (cur-comp-time (+ (* cur-hour 60) cur-min)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 ;; If the time is 12:01am, we should update our
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 ;; appointments to todays list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 (if (= cur-comp-time 1)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 (if (and view-diary-entries-initially appt-display-diary)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (diary)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (let ((diary-display-hook 'appt-make-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (diary))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 ;; If there are entries in the list, and the
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 ;; user wants a message issued
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 ;; get the first time off of the list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 ;; and calculate the number of minutes until
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 ;; the appointment.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (if (and appt-issue-message appt-time-msg-list)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (let ((appt-comp-time (car (car (car appt-time-msg-list)))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (setq min-to-app (- appt-comp-time cur-comp-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 (while (and appt-time-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (< appt-comp-time cur-comp-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 (setq appt-time-msg-list (cdr appt-time-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 (if appt-time-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 (setq appt-comp-time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 (car (car (car appt-time-msg-list))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 ;; If we have an appointment between midnight and
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 ;; 'appt-message-warning-time' minutes after midnight,
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 ;; we must begin to issue a message before midnight.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 ;; Midnight is considered 0 minutes and 11:59pm is
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 ;; 1439 minutes. Therefore we must recalculate the minutes
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 ;; to appointment variable. It is equal to the number of
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 ;; minutes before midnight plus the number of
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 ;; minutes after midnight our appointment is.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 (if (and (< appt-comp-time appt-message-warning-time)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 (> (+ cur-comp-time appt-message-warning-time)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 max-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 (setq min-to-app (+ (- (1+ max-time) cur-comp-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 appt-comp-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 ;; issue warning if the appointment time is
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 ;; within appt-message-warning time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 (if (and (<= min-to-app appt-message-warning-time)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (>= min-to-app 0))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 (progn
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 (if appt-msg-window
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 (progn
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 (string-match
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 display-time-string)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (setq new-time (substring display-time-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (match-beginning 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (match-end 0)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (appt-disp-window min-to-app new-time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (car (cdr (car appt-time-msg-list)))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 ;;; else
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 (if appt-visible
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (message "%s"
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 (car (cdr (car appt-time-msg-list)))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 (if appt-audible
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (beep 1)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 (if appt-display-mode-line
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 (progn
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 (string-match
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 display-time-string)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 (setq new-time (substring display-time-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 (match-beginning 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 (match-end 0)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 (setq display-time-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 (concat "App't in "
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 min-to-app " min. " new-time " "))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 ;; force mode line updates - from time.el
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293 (save-excursion (set-buffer (other-buffer)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 (set-buffer-modified-p (buffer-modified-p))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 (sit-for 0)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 (if (= min-to-app 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 (setq appt-time-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 (cdr appt-time-msg-list)))))))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 ;; Display appointment message in a separate buffer.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 (defun appt-disp-window (min-to-app new-time appt-msg)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 (require 'electric)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 (save-window-excursion
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 ;; Make sure we're not in the minibuffer
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 ;; before splitting the window.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
310 (if (= (frame-height)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 (nth 3 (window-edges (selected-window))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 (appt-select-lowest-window)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 (split-window))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 (let* ((this-buffer (current-buffer))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 (appt-disp-buf (set-buffer (get-buffer-create "appt-buf"))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 (setq mode-line-format
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 (concat "-------------------- Appointment in "
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 min-to-app " minutes. " new-time " %-"))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (pop-to-buffer appt-disp-buf)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (insert-string appt-msg)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 (shrink-window-if-larger-than-buffer (get-buffer-window appt-disp-buf))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 (set-buffer-modified-p nil)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 (if appt-audible
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (beep 1))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 (sit-for appt-display-duration)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 (if appt-audible
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 (beep 1))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 (kill-buffer appt-disp-buf))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 662
diff changeset
332 ;; Select the lowest window on the frame.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 (defun appt-select-lowest-window ()
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 (setq lowest-window (selected-window))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 (let* ((bottom-edge (car (cdr (cdr (cdr (window-edges))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 (last-window (previous-window))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 (window-search t))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 (while window-search
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 (let* ((this-window (next-window))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 (next-bottom-edge (car (cdr (cdr (cdr
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 (window-edges this-window)))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 (if (< bottom-edge next-bottom-edge)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 (progn
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 (setq bottom-edge next-bottom-edge)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 (setq lowest-window this-window)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 (select-window this-window)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 (if (eq last-window this-window)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 (progn
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 (select-window lowest-window)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 (setq window-search nil)))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 (defun appt-add (new-appt-time new-appt-msg)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 "Add an appointment for the day at TIME and issue MESSAGE.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 The time should be in either 24 hour format or am/pm format."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (if (string-match "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?" new-appt-time)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 (error "Unacceptable time-string"))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 (appt-time (list (appt-convert-time new-appt-time)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 (time-msg (cons appt-time (list appt-time-string))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 (setq appt-time-msg-list (append appt-time-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 (list time-msg)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (defun appt-delete ()
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 "Delete an appointment from the list of appointments."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 (interactive)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 (let* ((tmp-msg-list appt-time-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (while tmp-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 (let* ((element (car tmp-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 (prompt-string (concat "Delete "
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 (prin1-to-string (car (cdr element)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 " from list? "))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379 (test-input (y-or-n-p prompt-string)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 (setq tmp-msg-list (cdr tmp-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 (if test-input
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 (setq appt-time-msg-list (delq element appt-time-msg-list)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 (setq tmp-appt-msg-list nil)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 (message "")))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 ;; Create the appointments list from todays diary buffer.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 ;; The time must be at the beginning of a line for it to be
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 ;; put in the appointments list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 ;; 02/23/89
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 ;; 12:00pm lunch
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 ;; Wednesday
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 ;; 10:00am group meeting"
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394
927
587a08c3a70b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 846
diff changeset
395 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 (defun appt-make-list ()
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 (setq appt-time-msg-list nil)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 (save-excursion
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 (if diary-entries-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 ;; Cycle through the entry-list (diary-entries-list)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 ;; looking for entries beginning with a time. If
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 ;; the entry begins with a time, add it to the
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 ;; appt-time-msg-list. Then sort the list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407 (let ((entry-list diary-entries-list)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 (new-time-string ""))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 (while (and entry-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 (calendar-date-equal
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 (calendar-current-date) (car (car entry-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 (let ((time-string (substring (prin1-to-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 (cdr (car entry-list))) 2 -2)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 (while (string-match
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?.*"
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 time-string)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 (let* ((appt-time-string (substring time-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 (match-beginning 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 (match-end 0))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 (if (< (match-end 0) (length time-string))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 (setq new-time-string (substring time-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 (+ (match-end 0) 1)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 nil))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 (setq new-time-string ""))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428 (string-match "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 time-string)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 (let* ((appt-time (list (appt-convert-time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 (substring time-string
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 (match-beginning 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 (match-end 0)))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 (time-msg (cons appt-time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 (list appt-time-string))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 (setq time-string new-time-string)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 (setq appt-time-msg-list (append appt-time-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 (list time-msg)))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 (setq entry-list (cdr entry-list)))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 ;; Get the current time and convert it to minutes
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 ;; from midnight. ie. 12:01am = 1, midnight = 0,
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 ;; so that the elements in the list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 ;; that are earlier than the present time can
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 ;; be removed.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449 (let* ((cur-hour(string-to-int
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 (substring (current-time-string) 11 13)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 (cur-min (string-to-int
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 (substring (current-time-string) 14 16)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 (cur-comp-time (+ (* cur-hour 60) cur-min))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454 (appt-comp-time (car (car (car appt-time-msg-list)))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 (while (and appt-time-msg-list (< appt-comp-time cur-comp-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 (setq appt-time-msg-list (cdr appt-time-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 (if appt-time-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 (setq appt-comp-time (car (car (car appt-time-msg-list)))))))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462 ;;Simple sort to put the appointments list in order.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463 ;;Scan the list for the smallest element left in the list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 ;;Append the smallest element left into the new list, and remove
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 ;;it from the original list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 (defun appt-sort-list (appt-list)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 (let ((order-list nil))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468 (while appt-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 (let* ((element (car appt-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 (element-time (car (car element)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 (tmp-list (cdr appt-list)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 (while tmp-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 (if (< element-time (car (car (car tmp-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 (setq element (car tmp-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 (setq element-time (car (car element))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 (setq tmp-list (cdr tmp-list)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 (setq order-list (append order-list (list element)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 (setq appt-list (delq element appt-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 order-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 (defun appt-convert-time (time2conv)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 "Convert hour:min[am/pm] format to minutes from midnight."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 (let ((conv-time 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 (hr 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 (min 0))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 (string-match ":[0-9][0-9]" time2conv)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 (setq min (string-to-int
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 (substring time2conv
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493 (+ (match-beginning 0) 1) (match-end 0))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 (string-match "[0-9]?[0-9]:" time2conv)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 (setq hr (string-to-int
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 (substring time2conv
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 (match-beginning 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 (match-end 0))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 ;; convert the time appointment time into 24 hour time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 (if (and (string-match "[p][m]" time2conv) (< hr 12))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504 (progn
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 (string-match "[0-9]?[0-9]:" time2conv)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506 (setq hr (+ 12 hr))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 ;; convert the actual time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 ;; into minutes for comparison
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 ;; against the actual time.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512 (setq conv-time (+ (* hr 60) min))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513 conv-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 (setq display-time-hook 'appt-check)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
516
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 179
diff changeset
517 ;;; appt.el ends here