annotate lisp/calendar/appt.el @ 43567:26cb2bd7070b

(sorter mode-name): New. (ibuffer-do-occur): Don't quote ibuffer-marked-char.
author Colin Walters <walters@gnu.org>
date Tue, 26 Feb 2002 19:53:56 +0000
parents 6ecdf9c3fd25
children 426c8cf1a3df
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 30538
diff changeset
1 ;;; appt.el --- appointment notification functions
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 179
diff changeset
2
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
3 ;; Copyright (C) 1989, 1990, 1994, 1998 Free Software Foundation, Inc.
846
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>
6222
957444150c1a Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 6170
diff changeset
6 ;; Maintainer: FSF
807
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
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13125
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13125
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13125
diff changeset
24 ;; Boston, MA 02111-1307, USA.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
26 ;;; Commentary:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
27
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; appt.el - visible and/or audible notification of
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
30 ;; appointments from ~/diary file.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;;;
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
33 ;;; Thanks to Edward M. Reingold for much help and many suggestions,
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;;; And to many others for bug fixes and suggestions.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ;;; This functions in this file will alert the user of a
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ;;; pending appointment based on their diary file.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ;;;
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
40 ;;; A message will be displayed in the mode line of the Emacs buffer
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
41 ;;; and (if you request) the terminal will beep and display a message
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
42 ;;; from the diary in the mini-buffer, or you can choose to
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 ;;; have a message displayed in a new buffer.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 ;;;
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
45 ;;; The variable `appt-message-warning-time' allows the
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ;;; user to specify how much notice they want before the appointment. The
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
47 ;;; variable `appt-issue-message' specifies whether the user wants
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;;; to to be notified of a pending appointment.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;;;
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
50 ;;; In order to use the appt package, you only need
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
51 ;;; to load it---provided you have appointments.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 ;;;
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
53 ;;; Before that, you can also set some options if you want
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
54 ;;; (setq view-diary-entries-initially t)
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
55 ;;; (setq appt-issue-message t)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 ;;; This is an example of what can be in your diary file:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 ;;; Monday
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 ;;; 9:30am Coffee break
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 ;;; 12:00pm Lunch
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 ;;; Based upon the above lines in your .emacs and diary files,
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 ;;; the calendar and diary will be displayed when you enter
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
64 ;;; Emacs and your appointments list will automatically be created.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 ;;; You will then be reminded at 9:20am about your coffee break
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 ;;; and at 11:50am to go to lunch.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 ;;; Use describe-function on appt-check for a description of other variables
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 ;;; that can be used to personalize the notification system.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 ;;; In order to add or delete items from todays list, use appt-add
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 ;;; and appt-delete.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 ;;; Additionally, the appointments list is recreated automatically
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 ;;; 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
76 ;;; late.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 ;;;
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
78 ;;; Brief internal description - Skip this if you are not interested!
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 ;;;
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 ;;; The function appt-make-list creates the appointments list which appt-check
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 ;;; reads. This is all done automatically.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 ;;; It is invoked from the function list-diary-entries.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 ;;;
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
84 ;;; You can change the way the appointment window is created/deleted by
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
85 ;;; setting the variables
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
86 ;;;
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
87 ;;; appt-disp-window-function
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
88 ;;; and
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
89 ;;; appt-delete-window-function
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
90 ;;;
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
91 ;;; For instance, these variables can be set to functions that display
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
92 ;;; appointments in pop-up frames, which are lowered or iconified after
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
93 ;;; appt-display-interval minutes.
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
94 ;;;
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
95
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
96 ;;; Code:
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
97
8500
1e2396756604 Require calendar.
Richard M. Stallman <rms@gnu.org>
parents: 8493
diff changeset
98 ;; Make sure calendar is loaded when we compile this.
1e2396756604 Require calendar.
Richard M. Stallman <rms@gnu.org>
parents: 8493
diff changeset
99 (require 'calendar)
1e2396756604 Require calendar.
Richard M. Stallman <rms@gnu.org>
parents: 8493
diff changeset
100
12549
f92983da3dfd Add provide.
Karl Heuer <kwzh@gnu.org>
parents: 11592
diff changeset
101 (provide 'appt)
f92983da3dfd Add provide.
Karl Heuer <kwzh@gnu.org>
parents: 11592
diff changeset
102
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
103 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
104 (defcustom appt-issue-message t
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 "*Non-nil means check for appointments in the diary buffer.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 To be detected, the diary entry must have the time
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
107 as the first thing on a line."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
108 :type 'boolean
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
109 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
111 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
112 (defcustom appt-message-warning-time 12
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
113 "*Time in minutes before an appointment that the warning begins."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
114 :type 'integer
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
115 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
117 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
118 (defcustom appt-audible t
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
119 "*Non-nil means beep to indicate appointment."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
120 :type 'boolean
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
121 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
123 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
124 (defcustom appt-visible t
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
125 "*Non-nil means display appointment message in echo area."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
126 :type 'boolean
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
127 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
129 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
130 (defcustom appt-display-mode-line t
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
131 "*Non-nil means display minutes to appointment and time on the mode line."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
132 :type 'boolean
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
133 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
135 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
136 (defcustom appt-msg-window t
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
137 "*Non-nil means display appointment message in another window."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
138 :type 'boolean
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
139 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
141 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
142 (defcustom appt-display-duration 10
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
143 "*The number of seconds an appointment message is displayed."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
144 :type 'integer
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
145 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146
957
2619b7a9c11e entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 927
diff changeset
147 ;;;###autoload
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
148 (defcustom appt-display-diary t
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 "*Non-nil means to display the next days diary on the screen.
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
150 This will occur at midnight when the appointment list is updated."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
151 :type 'boolean
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
152 :group 'appt)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 (defvar appt-time-msg-list nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 "The list of appointments for today.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 Use `appt-add' and `appt-delete' to add and delete appointments from list.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 The original list is generated from the today's `diary-entries-list'.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 The number before each time/message is the time in minutes from midnight.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
160 (defconst appt-max-time 1439
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 "11:59pm in minutes - number of minutes in a day minus 1.")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162
17624
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
163 (defcustom appt-display-interval 3
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
164 "*Number of minutes to wait between checking the appointment list."
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
165 :type 'integer
7634c31da26e Add defgroup and use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 15679
diff changeset
166 :group 'appt)
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
167
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
168 (defvar appt-buffer-name " *appt-buf*"
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
169 "Name of the appointments buffer.")
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
170
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
171 (defvar appt-disp-window-function 'appt-disp-window
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
172 "Function called to display appointment window.")
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
173
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
174 (defvar appt-delete-window-function 'appt-delete-window
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
175 "Function called to remove appointment window and buffer.")
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
176
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
177 (defvar appt-mode-string nil
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
178 "String being displayed in the mode line saying you have an appointment.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
179 The actual string includes the amount of time till the appointment.")
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
180
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
181 (defvar appt-prev-comp-time nil
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
182 "Time of day (mins since midnight) at which we last checked appointments.")
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
183
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
184 (defvar appt-now-displayed nil
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
185 "Non-nil when we have started notifying about a appointment that is near.")
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
186
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
187 (defvar appt-display-count nil)
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
188
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 (defun appt-check ()
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 "Check for an appointment and update the mode line.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 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
192 for a warning to be issued.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 The format of the time can be either 24 hour or am/pm.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 Example:
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 02/23/89
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 18:00 Dinner
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 Thursday
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 11:45am Lunch meeting.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
203 Appointments are checked every `appt-display-interval' minutes.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
204 The following variables control appointment notification:
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
206 `appt-issue-message'
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
207 If t, the diary buffer is checked for appointments.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
209 `appt-message-warning-time'
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
210 Variable used to determine if appointment message
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
211 should be displayed.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
213 `appt-audible'
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
214 Variable used to determine if appointment is audible.
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
215 Default is t.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
217 `appt-visible'
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
218 Variable used to determine if appointment message should be
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
219 displayed in the mini-buffer. Default is t.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
221 `appt-msg-window'
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
222 Variable used to determine if appointment message
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
223 should temporarily appear in another window. Mutually exclusive
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
224 to `appt-visible'.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
226 `appt-display-duration'
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
227 The number of seconds an appointment message
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
228 is displayed in another window.
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
229
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
230 `appt-disp-window-function'
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
231 Function called to display appointment window. You can customize
5668
139b23d6a97b (appt-check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 5659
diff changeset
232 appt.el by setting this variable to a function different from the
139b23d6a97b (appt-check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 5659
diff changeset
233 one provided with this package.
139b23d6a97b (appt-check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 5659
diff changeset
234
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
235 `appt-delete-window-function'
5668
139b23d6a97b (appt-check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 5659
diff changeset
236 Function called to remove appointment window and buffer. You can
139b23d6a97b (appt-check): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 5659
diff changeset
237 customize appt.el by setting this variable to a function different
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
238 from the one provided with this package."
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
240 (let* ((min-to-app -1)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
241 (new-time "")
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
242 (prev-appt-mode-string appt-mode-string)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
243 (prev-appt-display-count (or appt-display-count 0))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
244 ;; Non-nil means do a full check for pending appointments
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
245 ;; and display in whatever ways the user has selected.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
246 ;; When no appointment is being displayed,
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
247 ;; we always do a full check.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
248 (full-check
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
249 (or (not appt-now-displayed)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
250 ;; This is true every appt-display-interval minutes.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
251 (= 0 (mod prev-appt-display-count appt-display-interval))))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
252 ;; Non-nil means only update the interval displayed in the mode line.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
253 (mode-line-only
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
254 (and (not full-check) appt-now-displayed)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
256 (when (or full-check mode-line-only)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
257 (save-excursion
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
258
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
259 ;; Get the current time and convert it to minutes
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
260 ;; from midnight. ie. 12:01am = 1, midnight = 0.
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
261
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
262 (let* ((now (decode-time))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
263 (cur-hour (nth 2 now))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
264 (cur-min (nth 1 now))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
265 (cur-comp-time (+ (* cur-hour 60) cur-min)))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
266
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
267 ;; At the first check in any given day, update our
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
268 ;; appointments to today's list.
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
269
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
270 (if (or (null appt-prev-comp-time)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
271 (< cur-comp-time appt-prev-comp-time))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
272 (condition-case nil
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
273 (progn
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
274 (if (and view-diary-entries-initially appt-display-diary)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
275 (diary)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
276 (let ((diary-display-hook 'appt-make-list))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
277 (diary))))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
278 (error nil)))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
279 (setq appt-prev-comp-time cur-comp-time)
23124
176e4901705d (appt-check): Clear appt-mode-string if we don't put something in it.
Karl Heuer <kwzh@gnu.org>
parents: 23123
diff changeset
280
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
281 (setq appt-mode-string nil)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
282 (setq appt-display-count nil)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
283
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
284 ;; If there are entries in the list, and the
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
285 ;; user wants a message issued,
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
286 ;; get the first time off of the list
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
287 ;; and calculate the number of minutes until the appointment.
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
288
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
289 (if (and appt-issue-message appt-time-msg-list)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
290 (let ((appt-comp-time (car (car (car appt-time-msg-list)))))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
291 (setq min-to-app (- appt-comp-time cur-comp-time))
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
292
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
293 (while (and appt-time-msg-list
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
294 (< appt-comp-time cur-comp-time))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
295 (setq appt-time-msg-list (cdr appt-time-msg-list))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
296 (if appt-time-msg-list
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
297 (setq appt-comp-time
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
298 (car (car (car appt-time-msg-list))))))
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
299
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
300 ;; If we have an appointment between midnight and
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
301 ;; 'appt-message-warning-time' minutes after midnight,
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
302 ;; we must begin to issue a message before midnight.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
303 ;; Midnight is considered 0 minutes and 11:59pm is
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
304 ;; 1439 minutes. Therefore we must recalculate the minutes
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
305 ;; to appointment variable. It is equal to the number of
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
306 ;; minutes before midnight plus the number of
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
307 ;; minutes after midnight our appointment is.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
309 (if (and (< appt-comp-time appt-message-warning-time)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
310 (> (+ cur-comp-time appt-message-warning-time)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
311 appt-max-time))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
312 (setq min-to-app (+ (- (1+ appt-max-time) cur-comp-time))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
313 appt-comp-time))
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
314
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
315 ;; issue warning if the appointment time is
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
316 ;; within appt-message-warning time
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
317
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
318 (when (and (<= min-to-app appt-message-warning-time)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
319 (>= min-to-app 0))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
320 (setq appt-now-displayed t)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
321 (setq appt-display-count
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
322 (1+ prev-appt-display-count))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
323 (unless mode-line-only
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
324 (if appt-msg-window
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
325 (progn
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
326 (setq new-time (format-time-string "%a %b %e "
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
327 (current-time)))
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
328 (funcall
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
329 appt-disp-window-function
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
330 (number-to-string min-to-app) new-time
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
331 (car (cdr (car appt-time-msg-list))))
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
332
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
333 (run-at-time
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
334 (format "%d sec" appt-display-duration)
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
335 nil
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
336 appt-delete-window-function))
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
337 ;;; else
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
338
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
339 (if appt-visible
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
340 (message "%s"
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
341 (car (cdr (car appt-time-msg-list)))))
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
342
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
343 (if appt-audible
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
344 (beep 1))))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
345
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
346 (when appt-display-mode-line
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
347 (setq appt-mode-string
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
348 (concat " App't in "
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
349 (number-to-string min-to-app)
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
350 " min. ")))
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
351
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
352 ;; When an appointment is reached,
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
353 ;; delete it from the list.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
354 ;; Reset the count to 0 in case we display another
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
355 ;; appointment on the next cycle.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
356 (if (= min-to-app 0)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
357 (setq appt-time-msg-list
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
358 (cdr appt-time-msg-list)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
359 appt-display-count nil)))))
5034
c7badee38b64 (appt-display-interval): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 957
diff changeset
360
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
361 ;; If we have changed the mode line string,
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
362 ;; redisplay all mode lines.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
363 (and appt-display-mode-line
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
364 (not (equal appt-mode-string
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
365 prev-appt-mode-string))
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
366 (progn
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
367 (force-mode-line-update t)
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
368 ;; If the string now has a notification,
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
369 ;; redisplay right now.
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
370 (if appt-mode-string
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
371 (sit-for 0)))))))))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (defun appt-disp-window (min-to-app new-time appt-msg)
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
375 "Display appointment message APPT-MSG in a separate buffer."
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 (require 'electric)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
378 ;; Make sure we're not in the minibuffer
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
379 ;; before splitting the window.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
381 (if (equal (selected-window) (minibuffer-window))
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
382 (if (other-window 1)
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
383 (select-window (other-window 1))
30538
c44ca494d993 (appt-disp-window): Use display-multi-frame-p
Eli Zaretskii <eliz@gnu.org>
parents: 30001
diff changeset
384 (if (display-multi-frame-p)
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
385 (select-frame (other-frame 1)))))
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
386
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
387 (let* ((this-buffer (current-buffer))
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
388 (this-window (selected-window))
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
389 (appt-disp-buf (set-buffer (get-buffer-create appt-buffer-name))))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390
9413
e54eede71446 (appt-delete-window): Look on all frames for the window.
Richard M. Stallman <rms@gnu.org>
parents: 8500
diff changeset
391 (if (cdr (assq 'unsplittable (frame-parameters)))
e54eede71446 (appt-delete-window): Look on all frames for the window.
Richard M. Stallman <rms@gnu.org>
parents: 8500
diff changeset
392 ;; In an unsplittable frame, use something somewhere else.
e54eede71446 (appt-delete-window): Look on all frames for the window.
Richard M. Stallman <rms@gnu.org>
parents: 8500
diff changeset
393 (display-buffer appt-disp-buf)
23777
5d10105c2906 (appt-disp-window): Use pop-to-buffer,
Richard M. Stallman <rms@gnu.org>
parents: 23297
diff changeset
394 (unless (or (special-display-p (buffer-name appt-disp-buf))
5d10105c2906 (appt-disp-window): Use pop-to-buffer,
Richard M. Stallman <rms@gnu.org>
parents: 23297
diff changeset
395 (same-window-p (buffer-name appt-disp-buf)))
5d10105c2906 (appt-disp-window): Use pop-to-buffer,
Richard M. Stallman <rms@gnu.org>
parents: 23297
diff changeset
396 ;; By default, split the bottom window and use the lower part.
5d10105c2906 (appt-disp-window): Use pop-to-buffer,
Richard M. Stallman <rms@gnu.org>
parents: 23297
diff changeset
397 (appt-select-lowest-window)
5d10105c2906 (appt-disp-window): Use pop-to-buffer,
Richard M. Stallman <rms@gnu.org>
parents: 23297
diff changeset
398 (split-window))
9413
e54eede71446 (appt-delete-window): Look on all frames for the window.
Richard M. Stallman <rms@gnu.org>
parents: 8500
diff changeset
399 (pop-to-buffer appt-disp-buf))
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
400 (setq mode-line-format
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
401 (concat "-------------------- Appointment in "
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
402 min-to-app " minutes. " new-time " %-"))
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
403 (erase-buffer)
41565
6ecdf9c3fd25 (appt-disp-window): Use insert instead of insert-string.
Pavel Janík <Pavel@Janik.cz>
parents: 38412
diff changeset
404 (insert appt-msg)
9413
e54eede71446 (appt-delete-window): Look on all frames for the window.
Richard M. Stallman <rms@gnu.org>
parents: 8500
diff changeset
405 (shrink-window-if-larger-than-buffer (get-buffer-window appt-disp-buf t))
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
406 (set-buffer-modified-p nil)
13125
731ef06c5677 (appt-disp-window): Call raise-frame.
Richard M. Stallman <rms@gnu.org>
parents: 12549
diff changeset
407 (raise-frame (selected-frame))
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
408 (select-window this-window)
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
409 (if appt-audible
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
410 (beep 1))))
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
411
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
412 (defun appt-delete-window ()
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
413 "Function called to undisplay appointment messages.
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
414 Usually just deletes the appointment buffer."
9551
ac21ac5e8c69 (appt-select-lowest-window): Locally bind lowest-window.
Richard M. Stallman <rms@gnu.org>
parents: 9413
diff changeset
415 (let ((window (get-buffer-window appt-buffer-name t)))
ac21ac5e8c69 (appt-select-lowest-window): Locally bind lowest-window.
Richard M. Stallman <rms@gnu.org>
parents: 9413
diff changeset
416 (and window
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
417 (or (eq window (frame-root-window (window-frame window)))
9551
ac21ac5e8c69 (appt-select-lowest-window): Locally bind lowest-window.
Richard M. Stallman <rms@gnu.org>
parents: 9413
diff changeset
418 (delete-window window))))
5659
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
419 (kill-buffer appt-buffer-name)
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
420 (if appt-audible
32a02ab40d58 (appt-check): Use the new variables
Richard M. Stallman <rms@gnu.org>
parents: 5034
diff changeset
421 (beep 1)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 (defun appt-select-lowest-window ()
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
424 "Select the lowest window on the frame."
30001
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
425 (let ((lowest-window (selected-window))
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
426 (bottom-edge (nth 3 (window-edges))))
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
427 (walk-windows (lambda (w)
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
428 (let ((next-bottom-edge (nth 3 (window-edges w))))
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
429 (when (< bottom-edge next-bottom-edge)
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
430 (setq bottom-edge next-bottom-edge
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
431 lowest-window w)))))
55656f797f82 (appt-select-lowest-window): Use walk-windows
Gerd Moellmann <gerd@gnu.org>
parents: 28968
diff changeset
432 (select-window lowest-window)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
434 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 (defun appt-add (new-appt-time new-appt-msg)
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
436 "Add an appointment for the day at NEW-APPT-TIME and issue message NEW-APPT-MSG.
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 The time should be in either 24 hour format or am/pm format."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 (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
441 nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 (error "Unacceptable time-string"))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 (appt-time (list (appt-convert-time new-appt-time)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 (time-msg (cons appt-time (list appt-time-string))))
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
447 (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
450 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 (defun appt-delete ()
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 "Delete an appointment from the list of appointments."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 (interactive)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454 (let* ((tmp-msg-list appt-time-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 (while tmp-msg-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 (let* ((element (car tmp-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 (prompt-string (concat "Delete "
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 (prin1-to-string (car (cdr element)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 " from list? "))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 (test-input (y-or-n-p prompt-string)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 (setq tmp-msg-list (cdr tmp-msg-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462 (if test-input
9551
ac21ac5e8c69 (appt-select-lowest-window): Locally bind lowest-window.
Richard M. Stallman <rms@gnu.org>
parents: 9413
diff changeset
463 (setq appt-time-msg-list (delq element appt-time-msg-list)))))
26677
b6b1fe18ecf5 (appt-convert-time): Handle "12:MMam",
Gerd Moellmann <gerd@gnu.org>
parents: 24493
diff changeset
464 (appt-check)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 (message "")))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467
26935
9e0b4a6b5ad2 Bind free variables when compiling.
Dave Love <fx@gnu.org>
parents: 26677
diff changeset
468 (eval-when-compile (defvar number)
9e0b4a6b5ad2 Bind free variables when compiling.
Dave Love <fx@gnu.org>
parents: 26677
diff changeset
469 (defvar original-date)
9e0b4a6b5ad2 Bind free variables when compiling.
Dave Love <fx@gnu.org>
parents: 26677
diff changeset
470 (defvar diary-entries-list))
927
587a08c3a70b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 846
diff changeset
471 ;;;###autoload
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 (defun appt-make-list ()
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
473 "Create the appointments list from todays diary buffer.
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
474 The time must be at the beginning of a line for it to be
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
475 put in the appointments list.
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
476 02/23/89
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
477 12:00pm lunch
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
478 Wednesday
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
479 10:00am group meeting
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
480 We assume that the variables DATE and NUMBER
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
481 hold the arguments that `list-diary-entries' received.
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
482 They specify the range of dates that the diary is being processed for."
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
483
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
484 ;; We have something to do if the range of dates that the diary is
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
485 ;; considering includes the current date.
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
486 (if (and (not (calendar-date-compare
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
487 (list (calendar-current-date))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
488 (list original-date)))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
489 (calendar-date-compare
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
490 (list (calendar-current-date))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
491 (list (calendar-gregorian-from-absolute
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
492 (+ (calendar-absolute-from-gregorian original-date)
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
493 number)))))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
494 (save-excursion
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
495 ;; Clear the appointments list, then fill it in from the diary.
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
496 (setq appt-time-msg-list nil)
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
497 (if diary-entries-list
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
499 ;; Cycle through the entry-list (diary-entries-list)
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
500 ;; looking for entries beginning with a time. If
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
501 ;; the entry begins with a time, add it to the
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
502 ;; appt-time-msg-list. Then sort the list.
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
503
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
504 (let ((entry-list diary-entries-list)
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
505 (new-time-string ""))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
506 ;; Skip diary entries for dates before today.
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
507 (while (and entry-list
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
508 (calendar-date-compare
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
509 (car entry-list) (list (calendar-current-date))))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
510 (setq entry-list (cdr entry-list)))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
511 ;; Parse the entries for today.
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
512 (while (and entry-list
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
513 (calendar-date-equal
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
514 (calendar-current-date) (car (car entry-list))))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
515 (let ((time-string (substring (prin1-to-string
24493
8cc1b3739d56 (appt-make-list): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 24274
diff changeset
516 (cadr (car entry-list))) 1 -1)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
518 (while (string-match
28968
e6327d3d1115 (appt-make-list): Match all lines of entry.
Dave Love <fx@gnu.org>
parents: 28404
diff changeset
519 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\(.*\n\\)*.*"
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
520 time-string)
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
521 (let* ((appt-time-string (match-string 0 time-string)))
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
522
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
523 (if (< (match-end 0) (length time-string))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
524 (setq new-time-string (substring time-string
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
525 (+ (match-end 0) 1)
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
526 nil))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
527 (setq new-time-string ""))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
528
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
529 (string-match "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
530 time-string)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
532 (let* ((appt-time (list (appt-convert-time
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
533 (match-string 0 time-string))))
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
534 (time-msg (cons appt-time
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
535 (list appt-time-string))))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
536 (setq time-string new-time-string)
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
537 (setq appt-time-msg-list (nconc appt-time-msg-list
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
538 (list time-msg)))))))
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
539 (setq entry-list (cdr entry-list)))))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
540 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
542 ;; Get the current time and convert it to minutes
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
543 ;; from midnight. ie. 12:01am = 1, midnight = 0,
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
544 ;; so that the elements in the list
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
545 ;; that are earlier than the present time can
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
546 ;; be removed.
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
547
15679
4942f03c75f8 (appt-check, appt-make-list): Avoid race condition
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
548 (let* ((now (decode-time))
4942f03c75f8 (appt-check, appt-make-list): Avoid race condition
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
549 (cur-hour (nth 2 now))
4942f03c75f8 (appt-check, appt-make-list): Avoid race condition
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
550 (cur-min (nth 1 now))
8440
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
551 (cur-comp-time (+ (* cur-hour 60) cur-min))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
552 (appt-comp-time (car (car (car appt-time-msg-list)))))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
553
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
554 (while (and appt-time-msg-list (< appt-comp-time cur-comp-time))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
555 (setq appt-time-msg-list (cdr appt-time-msg-list))
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
556 (if appt-time-msg-list
863e05092c58 (appt-make-list): Do nothing unless range being processed
Richard M. Stallman <rms@gnu.org>
parents: 7298
diff changeset
557 (setq appt-comp-time (car (car (car appt-time-msg-list))))))))))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
559
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
560 (defun appt-sort-list (appt-list)
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
561 "Simple sort to put the appointments list APPT-LIST in order.
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
562 Scan the list for the smallest element left in the list.
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
563 Append the smallest element left into the new list, and remove
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
564 it from the original list."
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565 (let ((order-list nil))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 (while appt-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 (let* ((element (car appt-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568 (element-time (car (car element)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 (tmp-list (cdr appt-list)))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 (while tmp-list
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 (if (< element-time (car (car (car tmp-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 nil
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573 (setq element (car tmp-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 (setq element-time (car (car element))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 (setq tmp-list (cdr tmp-list)))
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
576 (setq order-list (nconc order-list (list element)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 (setq appt-list (delq element appt-list))))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 order-list))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581 (defun appt-convert-time (time2conv)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 "Convert hour:min[am/pm] format to minutes from midnight."
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584 (let ((conv-time 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585 (hr 0)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 (min 0))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
588 (string-match ":\\([0-9][0-9]\\)" time2conv)
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 (setq min (string-to-int
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
590 (match-string 1 time2conv)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592 (string-match "[0-9]?[0-9]:" time2conv)
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593 (setq hr (string-to-int
28404
243081e5c0e7 Doc fixes.
Dave Love <fx@gnu.org>
parents: 27829
diff changeset
594 (match-string 0 time2conv)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 ;; convert the time appointment time into 24 hour time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597
26677
b6b1fe18ecf5 (appt-convert-time): Handle "12:MMam",
Gerd Moellmann <gerd@gnu.org>
parents: 24493
diff changeset
598 (cond ((and (string-match "pm" time2conv) (< hr 12))
b6b1fe18ecf5 (appt-convert-time): Handle "12:MMam",
Gerd Moellmann <gerd@gnu.org>
parents: 24493
diff changeset
599 (setq hr (+ 12 hr)))
b6b1fe18ecf5 (appt-convert-time): Handle "12:MMam",
Gerd Moellmann <gerd@gnu.org>
parents: 24493
diff changeset
600 ((and (string-match "am" time2conv) (= hr 12))
b6b1fe18ecf5 (appt-convert-time): Handle "12:MMam",
Gerd Moellmann <gerd@gnu.org>
parents: 24493
diff changeset
601 (setq hr 0)))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 ;; convert the actual time
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 ;; into minutes for comparison
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 ;; against the actual time.
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607 (setq conv-time (+ (* hr 60) min))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 conv-time))
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
610 (defvar appt-timer nil
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
611 "Timer used for diary appointment notifications (`appt-check').")
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
612
23297
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
613 (unless appt-timer
e23cdc314c10 (appt-interval): Variable deleted.
Karl Heuer <kwzh@gnu.org>
parents: 23124
diff changeset
614 (setq appt-timer (run-at-time t 60 'appt-check)))
23112
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
615
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
616 (or global-mode-string (setq global-mode-string '("")))
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
617 (or (memq 'appt-mode-string global-mode-string)
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
618 (setq global-mode-string
81052242dbce (appt-mode-string): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 17624
diff changeset
619 (append global-mode-string '(appt-mode-string))))
179
b88e2c9f0f5b Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 179
diff changeset
621 ;;; appt.el ends here