Mercurial > emacs
annotate lisp/calendar/diary-lib.el @ 69280:ce00486eafec
*** empty log message ***
author | John Paul Wallington <jpw@pobox.com> |
---|---|
date | Sat, 04 Mar 2006 21:41:10 +0000 |
parents | 8daf7d9a0771 |
children | 2febbeb39125 4b3d39451150 |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37001
diff
changeset
|
1 ;;; diary-lib.el --- diary functions |
13053 | 2 |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
66929
diff
changeset
|
3 ;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1995, 2001, 2002, 2003, |
68721 | 4 ;; 2004, 2005, 2006 Free Software Foundation, Inc. |
13053 | 5 |
6 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | |
65919
5c09efcfc1d9
Update maintainer email address.
Glenn Morris <rgm@gnu.org>
parents:
65875
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
13053 | 8 ;; Keywords: calendar |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
13053 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; This collection of functions implements the diary features as described | |
30 ;; in calendar.el. | |
31 | |
32 ;; Comments, corrections, and improvements should be sent to | |
33 ;; Edward M. Reingold Department of Computer Science | |
34 ;; (217) 333-6733 University of Illinois at Urbana-Champaign | |
35 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue | |
36 ;; Urbana, Illinois 61801 | |
37 | |
38 ;;; Code: | |
39 | |
40 (require 'calendar) | |
41 | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
42 (defun diary-check-diary-file () |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
43 "Check that the file specified by `diary-file' exists and is readable. |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
44 If so, return the expanded file name, otherwise signal an error." |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
45 (let ((d-file (substitute-in-file-name diary-file))) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
46 (if (and d-file (file-exists-p d-file)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
47 (if (file-readable-p d-file) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
48 d-file |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
49 (error "Diary file `%s' is not readable" diary-file)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
50 (error "Diary file `%s' does not exist" diary-file)))) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
51 |
13053 | 52 ;;;###autoload |
53 (defun diary (&optional arg) | |
54 "Generate the diary window for ARG days starting with the current date. | |
55 If no argument is provided, the number of days of diary entries is governed | |
53557 | 56 by the variable `number-of-diary-entries'. A value of ARG less than 1 |
57 does nothing. This function is suitable for execution in a `.emacs' file." | |
13053 | 58 (interactive "P") |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
59 (diary-check-diary-file) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
60 (let ((date (calendar-current-date))) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
61 (diary-list-entries date (if arg (prefix-numeric-value arg))))) |
13053 | 62 |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
63 (define-obsolete-function-alias 'view-diary-entries 'diary-view-entries) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
64 (defun diary-view-entries (&optional arg) |
13053 | 65 "Prepare and display a buffer with diary entries. |
66 Searches the file named in `diary-file' for entries that | |
67 match ARG days starting with the date indicated by the cursor position | |
68 in the displayed three-month calendar." | |
69 (interactive "p") | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
70 (diary-check-diary-file) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
71 (diary-list-entries (calendar-cursor-to-date t) arg)) |
13053 | 72 |
22412
6fdc14d2b071
Don't overide default value of diary-file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
21957
diff
changeset
|
73 (defun view-other-diary-entries (arg d-file) |
13053 | 74 "Prepare and display buffer of diary entries from an alternative diary file. |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
75 Searches for entries that match ARG days, starting with the date indicated |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
76 by the cursor position in the displayed three-month calendar. |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
77 D-FILE specifies the file to use as the diary file." |
13053 | 78 (interactive |
59043
5ddb0b71254b
(view-other-diary-entries): Use current-prefix-arg in interactive spec.
Glenn Morris <rgm@gnu.org>
parents:
58101
diff
changeset
|
79 (list (prefix-numeric-value current-prefix-arg) |
22412
6fdc14d2b071
Don't overide default value of diary-file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
21957
diff
changeset
|
80 (read-file-name "Enter diary file name: " default-directory nil t))) |
6fdc14d2b071
Don't overide default value of diary-file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
21957
diff
changeset
|
81 (let ((diary-file d-file)) |
6fdc14d2b071
Don't overide default value of diary-file.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
21957
diff
changeset
|
82 (view-diary-entries arg))) |
13053 | 83 |
84 (autoload 'check-calendar-holidays "holidays" | |
85 "Check the list of holidays for any that occur on DATE. | |
86 The value returned is a list of strings of relevant holiday descriptions. | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
87 The holidays are those in the list `calendar-holidays'.") |
13053 | 88 |
89 (autoload 'calendar-holiday-list "holidays" | |
90 "Form the list of holidays that occur on dates in the calendar window. | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
91 The holidays are those in the list `calendar-holidays'.") |
13053 | 92 |
93 (autoload 'diary-french-date "cal-french" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
94 "French calendar equivalent of date diary entry.") |
13053 | 95 |
96 (autoload 'diary-mayan-date "cal-mayan" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
97 "Mayan calendar equivalent of date diary entry.") |
13053 | 98 |
13688
88f14fa8e205
Autoload diary-iso-date.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13687
diff
changeset
|
99 (autoload 'diary-iso-date "cal-iso" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
100 "ISO calendar equivalent of date diary entry.") |
13688
88f14fa8e205
Autoload diary-iso-date.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13687
diff
changeset
|
101 |
13053 | 102 (autoload 'diary-julian-date "cal-julian" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
103 "Julian calendar equivalent of date diary entry.") |
13053 | 104 |
105 (autoload 'diary-astro-day-number "cal-julian" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
106 "Astronomical (Julian) day number diary entry.") |
13053 | 107 |
14687
0d4ff7e4d6a3
Use the new file names in autoloads.
Karl Heuer <kwzh@gnu.org>
parents:
14308
diff
changeset
|
108 (autoload 'diary-chinese-date "cal-china" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
109 "Chinese calendar equivalent of date diary entry.") |
13053 | 110 |
14687
0d4ff7e4d6a3
Use the new file names in autoloads.
Karl Heuer <kwzh@gnu.org>
parents:
14308
diff
changeset
|
111 (autoload 'diary-islamic-date "cal-islam" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
112 "Islamic calendar equivalent of date diary entry.") |
13053 | 113 |
14687
0d4ff7e4d6a3
Use the new file names in autoloads.
Karl Heuer <kwzh@gnu.org>
parents:
14308
diff
changeset
|
114 (autoload 'list-islamic-diary-entries "cal-islam" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
115 "Add any Islamic date entries from the diary file to `diary-entries-list'.") |
13053 | 116 |
14687
0d4ff7e4d6a3
Use the new file names in autoloads.
Karl Heuer <kwzh@gnu.org>
parents:
14308
diff
changeset
|
117 (autoload 'mark-islamic-diary-entries "cal-islam" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
118 "Mark days in the calendar window that have Islamic date diary entries.") |
13053 | 119 |
14687
0d4ff7e4d6a3
Use the new file names in autoloads.
Karl Heuer <kwzh@gnu.org>
parents:
14308
diff
changeset
|
120 (autoload 'mark-islamic-calendar-date-pattern "cal-islam" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
121 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR.") |
13053 | 122 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
123 (autoload 'diary-bahai-date "cal-bahai" |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
124 "Baha'i calendar equivalent of date diary entry." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
125 t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
126 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
127 (autoload 'list-bahai-diary-entries "cal-bahai" |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
128 "Add any Baha'i date entries from the diary file to `diary-entries-list'." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
129 t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
130 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
131 (autoload 'mark-bahai-diary-entries "cal-bahai" |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
132 "Mark days in the calendar window that have Baha'i date diary entries." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
133 t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
134 |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
135 (autoload 'mark-bahai-calendar-date-pattern "cal-bahai" |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
136 "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR." |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
137 t) |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
138 |
13053 | 139 (autoload 'diary-hebrew-date "cal-hebrew" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
140 "Hebrew calendar equivalent of date diary entry.") |
13053 | 141 |
142 (autoload 'diary-omer "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
143 "Omer count diary entry.") |
13053 | 144 |
145 (autoload 'diary-yahrzeit "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
146 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.") |
13053 | 147 |
148 (autoload 'diary-parasha "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
149 "Parasha diary entry--entry applies if date is a Saturday.") |
13053 | 150 |
151 (autoload 'diary-rosh-hodesh "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
152 "Rosh Hodesh diary entry.") |
13053 | 153 |
154 (autoload 'list-hebrew-diary-entries "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
155 "Add any Hebrew date entries from the diary file to `diary-entries-list'.") |
13053 | 156 |
157 (autoload 'mark-hebrew-diary-entries "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
158 "Mark days in the calendar window that have Hebrew date diary entries.") |
13053 | 159 |
160 (autoload 'mark-hebrew-calendar-date-pattern "cal-hebrew" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
161 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR.") |
13053 | 162 |
163 (autoload 'diary-coptic-date "cal-coptic" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
164 "Coptic calendar equivalent of date diary entry.") |
13053 | 165 |
166 (autoload 'diary-ethiopic-date "cal-coptic" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
167 "Ethiopic calendar equivalent of date diary entry.") |
13053 | 168 |
15258
ab5975df6164
Change autoload references from cal-persian to cal-persia.
Karl Heuer <kwzh@gnu.org>
parents:
14954
diff
changeset
|
169 (autoload 'diary-persian-date "cal-persia" |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
170 "Persian calendar equivalent of date diary entry.") |
14954
a9102c34a5b6
Fix length of separator string.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14687
diff
changeset
|
171 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
172 (autoload 'diary-phases-of-moon "lunar" "Moon phases diary entry.") |
13053 | 173 |
174 (autoload 'diary-sunrise-sunset "solar" | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
175 "Local time of sunrise and sunset as a diary entry.") |
13053 | 176 |
177 (autoload 'diary-sabbath-candles "solar" | |
178 "Local time of candle lighting diary entry--applies if date is a Friday. | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
179 No diary entry if there is no sunset on that date.") |
13053 | 180 |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
181 (defvar diary-syntax-table |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
182 (let ((st (copy-syntax-table (standard-syntax-table)))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
183 (modify-syntax-entry ?* "w" st) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
184 (modify-syntax-entry ?: "w" st) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
185 st) |
13053 | 186 "The syntax table used when parsing dates in the diary file. |
187 It is the standard syntax table used in Fundamental mode, but with the | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
188 syntax of `*' and `:' changed to be word constituents.") |
13053 | 189 |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
190 (defvar diary-entries-list) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
191 (defvar displayed-year) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
192 (defvar displayed-month) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
193 (defvar entry) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
194 (defvar date) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
195 (defvar number) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
196 (defvar date-string) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
197 (defvar original-date) |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
198 |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
199 (defun diary-attrtype-convert (attrvalue type) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
200 "Convert string ATTRVALUE to TYPE appropriate for a face description. |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
201 Valid TYPEs are: string, symbol, int, stringtnil, tnil." |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
202 (let (ret) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
203 (setq ret (cond ((eq type 'string) attrvalue) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
204 ((eq type 'symbol) (read attrvalue)) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61384
diff
changeset
|
205 ((eq type 'int) (string-to-number attrvalue)) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
206 ((eq type 'stringtnil) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
207 (cond ((string= "t" attrvalue) t) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
208 ((string= "nil" attrvalue) nil) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
209 (t attrvalue))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
210 ((eq type 'tnil) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
211 (cond ((string= "t" attrvalue) t) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
212 ((string= "nil" attrvalue) nil))))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
213 ; (message "(%s)[%s]=[%s]" (print type) attrvalue ret) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
214 ret)) |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
215 |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
216 |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
217 (defun diary-pull-attrs (entry fileglobattrs) |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
218 "Pull the face-related attributes off the entry, merge with the |
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
219 fileglobattrs, and return the (possibly modified) entry and face |
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
220 data in a list of attrname attrvalue values. |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
221 The entry will be modified to drop all tags that are used for face matching. |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
222 If entry is nil, then the fileglobattrs are being searched for, |
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
223 the fileglobattrs variable is ignored, and |
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
224 diary-glob-file-regexp-prefix is prepended to the regexps before each |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
225 search." |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
226 (save-excursion |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
227 (let (regexp regnum attrname attr-list attrname attrvalue type |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
228 ret-attr attr) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
229 (if (null entry) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
230 (progn |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
231 (setq ret-attr '() |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
232 attr-list diary-face-attrs) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
233 (while attr-list |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
234 (goto-char (point-min)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
235 (setq attr (car attr-list) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
236 regexp (nth 0 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
237 regnum (nth 1 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
238 attrname (nth 2 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
239 type (nth 3 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
240 regexp (concat diary-glob-file-regexp-prefix regexp)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
241 (setq attrvalue nil) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
242 (if (re-search-forward regexp (point-max) t) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
243 (setq attrvalue (match-string-no-properties regnum))) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
244 (if (and attrvalue |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
245 (setq attrvalue (diary-attrtype-convert attrvalue type))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
246 (setq ret-attr (append ret-attr (list attrname attrvalue)))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
247 (setq attr-list (cdr attr-list))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
248 (setq fileglobattrs ret-attr)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
249 (progn |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
250 (setq ret-attr fileglobattrs |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
251 attr-list diary-face-attrs) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
252 (while attr-list |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
253 (goto-char (point-min)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
254 (setq attr (car attr-list) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
255 regexp (nth 0 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
256 regnum (nth 1 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
257 attrname (nth 2 attr) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
258 type (nth 3 attr)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
259 (setq attrvalue nil) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
260 (if (string-match regexp entry) |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
261 (progn |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
262 (setq attrvalue (match-string-no-properties regnum entry)) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
263 (setq entry (replace-match "" t t entry)))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
264 (if (and attrvalue |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
265 (setq attrvalue (diary-attrtype-convert attrvalue type))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
266 (setq ret-attr (append ret-attr (list attrname attrvalue)))) |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
267 (setq attr-list (cdr attr-list))))) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
268 (list entry ret-attr)))) |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
269 |
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
270 |
52412
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
271 ;; This can be removed once the kill/yank treatment of invisible text |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
272 ;; (see etc/TODO) is fixed. -- gm |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
273 (defcustom diary-header-line-flag t |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
274 "If non-nil, `diary-simple-display' will show a header line. |
52412
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
275 The format of the header is specified by `diary-header-line-format'." |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
276 :group 'diary |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
277 :type 'boolean |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59063
diff
changeset
|
278 :version "22.1") |
52412
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
279 |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
280 (defvar diary-selective-display nil) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
281 |
52412
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
282 (defcustom diary-header-line-format |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
283 '(:eval (calendar-string-spread |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
284 (list (if diary-selective-display |
52412
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
285 "Selective display active - press \"s\" in calendar \ |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
286 before edit/copy" |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
287 "Diary")) |
63851
45ed77379ac6
(diary-header-line-format): Change space constants followed by a sexp to "?\s ".
Juanma Barranquero <lekktu@gmail.com>
parents:
63222
diff
changeset
|
288 ?\s (frame-width))) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
289 "Format of the header line displayed by `diary-simple-display'. |
52412
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
290 Only used if `diary-header-line-flag' is non-nil." |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
291 :group 'diary |
58f90e8a7543
(diary-header-line-flag, diary-header-line-format): New variables.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
292 :type 'sexp |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59063
diff
changeset
|
293 :version "22.1") |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
294 |
57255 | 295 (defvar diary-saved-point) ; internal |
296 | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
297 |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
298 (defcustom number-of-diary-entries 1 |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
299 "Specifies how many days of diary entries are to be displayed initially. |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
300 This variable affects the diary display when the command \\[diary] is used, |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
301 or if the value of the variable `view-diary-entries-initially' is t. For |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
302 example, if the default value 1 is used, then only the current day's diary |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
303 entries will be displayed. If the value 2 is used, then both the current |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
304 day's and the next day's entries will be displayed. |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
305 |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
306 The value can also be a vector such as [0 2 2 2 2 4 1]; this value |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
307 says to display no diary entries on Sunday, the display the entries |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
308 for the current date and the day after on Monday through Thursday, |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
309 display Friday through Monday's entries on Friday, and display only |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
310 Saturday's entries on Saturday. |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
311 |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
312 This variable does not affect the diary display with the `d' command |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
313 from the calendar; in that case, the prefix argument controls the |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
314 number of days of diary entries displayed." |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
315 :type '(choice (integer :tag "Entries") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
316 (vector :value [0 0 0 0 0 0 0] |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
317 (integer :tag "Sunday") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
318 (integer :tag "Monday") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
319 (integer :tag "Tuesday") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
320 (integer :tag "Wednesday") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
321 (integer :tag "Thursday") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
322 (integer :tag "Friday") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
323 (integer :tag "Saturday"))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
324 :group 'diary) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
325 |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
326 (define-obsolete-function-alias 'list-diary-entries 'diary-list-entries) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
327 (defun diary-list-entries (date number &optional list-only) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
328 "Create and display a buffer containing the relevant lines in `diary-file'. |
13053 | 329 The arguments are DATE and NUMBER; the entries selected are those |
330 for NUMBER days starting with date DATE. The other entries are hidden | |
53557 | 331 using selective display. If NUMBER is less than 1, this function does nothing. |
13053 | 332 |
333 Returns a list of all relevant diary entries found, if any, in order by date. | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
334 The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
335 \(MONTH DAY YEAR) is the date of the entry, STRING is the entry text, and |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
336 SPECIFIER is the applicability. If the variable `diary-list-include-blanks' |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
337 is t, this list includes a dummy diary entry consisting of the empty string |
20269
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
338 for a date with no diary entries. |
13053 | 339 |
340 After the list is prepared, the hooks `nongregorian-diary-listing-hook', | |
341 `list-diary-entries-hook', `diary-display-hook', and `diary-hook' are run. | |
342 These hooks have the following distinct roles: | |
343 | |
344 `nongregorian-diary-listing-hook' can cull dates from the diary | |
345 and each included file. Usually used for Hebrew or Islamic | |
346 diary entries in files. Applied to *each* file. | |
347 | |
348 `list-diary-entries-hook' adds or manipulates diary entries from | |
349 external sources. Used, for example, to include diary entries | |
350 from other files or to sort the diary entries. Invoked *once* only, | |
351 before the display hook is run. | |
352 | |
353 `diary-display-hook' does the actual display of information. If this is | |
354 nil, simple-diary-display will be used. Use add-hook to set this to | |
355 fancy-diary-display, if desired. If you want no diary display, use | |
356 add-hook to set this to ignore. | |
357 | |
358 `diary-hook' is run last. This can be used for an appointment | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
359 notification function. |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
360 |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
361 If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
362 (unless number |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
363 (setq number (if (vectorp number-of-diary-entries) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
364 (aref number-of-diary-entries (calendar-day-of-week date)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
365 number-of-diary-entries))) |
53557 | 366 (when (> number 0) |
367 (let ((original-date date);; save for possible use in the hooks | |
368 diary-entries-list | |
369 file-glob-attrs | |
370 (date-string (calendar-date-string date)) | |
371 (d-file (substitute-in-file-name diary-file))) | |
372 (message "Preparing diary...") | |
373 (save-excursion | |
374 (let ((diary-buffer (find-buffer-visiting d-file))) | |
375 (if (not diary-buffer) | |
376 (set-buffer (find-file-noselect d-file t)) | |
377 (set-buffer diary-buffer) | |
378 (or (verify-visited-file-modtime diary-buffer) | |
379 (revert-buffer t t)))) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
380 ;; Setup things like the header-line-format and invisibility-spec. |
66869
cfc510b6c9e6
(diary-list-entries, diary-show-all-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66429
diff
changeset
|
381 (when (eq major-mode default-major-mode) (diary-mode)) |
57255 | 382 ;; d-s-p is passed to the diary display function. |
383 (let ((diary-saved-point (point))) | |
384 (save-excursion | |
385 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil ""))) | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
386 (with-syntax-table diary-syntax-table |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
387 (let ((mark (regexp-quote diary-nonmarking-symbol))) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
388 (goto-char (point-min)) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
389 (unless list-only |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
390 (let ((ol (make-overlay (point-min) (point-max) nil t nil))) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
391 (set (make-local-variable 'diary-selective-display) t) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
392 (overlay-put ol 'invisible 'diary) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
393 (overlay-put ol 'evaporate t))) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
394 (calendar-for-loop |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
395 i from 1 to number do |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
396 (let ((month (extract-calendar-month date)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
397 (day (extract-calendar-day date)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
398 (year (extract-calendar-year date)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
399 (entry-found (list-sexp-diary-entries date))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
400 (dolist (date-form diary-date-forms) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
401 (let* |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
402 ((backup (when (eq (car date-form) 'backup) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
403 (setq date-form (cdr date-form)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
404 t)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
405 (dayname |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
406 (format "%s\\|%s\\.?" |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
407 (calendar-day-name date) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
408 (calendar-day-name date 'abbrev))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
409 (monthname |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
410 (format "\\*\\|%s\\|%s\\.?" |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
411 (calendar-month-name month) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
412 (calendar-month-name month 'abbrev))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
413 (month (concat "\\*\\|0*" (int-to-string month))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
414 (day (concat "\\*\\|0*" (int-to-string day))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
415 (year |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
416 (concat |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
417 "\\*\\|0*" (int-to-string year) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
418 (if abbreviated-calendar-year |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
419 (concat "\\|" (format "%02d" (% year 100))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
420 ""))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
421 (regexp |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
422 (concat |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
423 "\\(\\`\\|\^M\\|\n\\)" mark "?\\(" |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
424 (mapconcat 'eval date-form "\\)\\(?:") |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
425 "\\)")) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
426 (case-fold-search t)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
427 (goto-char (point-min)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
428 (while (re-search-forward regexp nil t) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
429 (if backup (re-search-backward "\\<" nil t)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
430 (if (and (or (char-equal (preceding-char) ?\^M) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
431 (char-equal (preceding-char) ?\n)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
432 (not (looking-at " \\|\^I"))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
433 ;; Diary entry that consists only of date. |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
434 (backward-char 1) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
435 ;; Found a nonempty diary entry--make it |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
436 ;; visible and add it to the list. |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
437 (setq entry-found t) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
438 (let ((entry-start (point)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
439 date-start temp) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
440 (re-search-backward "\^M\\|\n\\|\\`") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
441 (setq date-start (point)) |
66429
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
442 ;; When selective display (rather than |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
443 ;; overlays) was used, diary file used to |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
444 ;; start in a blank line and end in a |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
445 ;; newline. Now that neither of these |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
446 ;; need be true, 'move handles the latter |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
447 ;; and 1/2 kludge the former. |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
448 (re-search-forward |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
449 "\^M\\|\n" nil 'move |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
450 (if (and (bobp) (not (looking-at "\^M\\|\n"))) |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
451 1 |
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
452 2)) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
453 (while (looking-at " \\|\^I") |
66429
2b2388e245c9
(diary-list-entries): Prevent infloop when diary does not end in a
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
454 (re-search-forward "\^M\\|\n" nil 'move)) |
66929
35f26e779968
(diary-list-entries): Also hide the terminating newline.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66869
diff
changeset
|
455 (unless (and (eobp) (not (bolp))) |
35f26e779968
(diary-list-entries): Also hide the terminating newline.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66869
diff
changeset
|
456 (backward-char 1)) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
457 (unless list-only |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
458 (remove-overlays date-start (point) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
459 'invisible 'diary)) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
460 (setq entry (buffer-substring entry-start (point)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
461 temp (diary-pull-attrs entry file-glob-attrs) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
462 entry (nth 0 temp)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
463 (add-to-diary-list |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
464 date |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
465 entry |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
466 (buffer-substring |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
467 (1+ date-start) (1- entry-start)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
468 (copy-marker entry-start) (nth 1 temp))))))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
469 (or entry-found |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
470 (not diary-list-include-blanks) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
471 (setq diary-entries-list |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
472 (append diary-entries-list |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
473 (list (list date "" "" "" ""))))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
474 (setq date |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
475 (calendar-gregorian-from-absolute |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
476 (1+ (calendar-absolute-from-gregorian date)))) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
477 (setq entry-found nil))))) |
57255 | 478 (goto-char (point-min)) |
479 (run-hooks 'nongregorian-diary-listing-hook | |
480 'list-diary-entries-hook) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
481 (unless list-only |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
482 (if diary-display-hook |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
483 (run-hooks 'diary-display-hook) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
484 (simple-diary-display))) |
57255 | 485 (run-hooks 'diary-hook) |
486 diary-entries-list)))))) | |
13053 | 487 |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
488 (defun diary-unhide-everything () |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
489 (kill-local-variable 'diary-selective-display) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
490 (remove-overlays (point-min) (point-max) 'invisible 'diary) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
491 (kill-local-variable 'mode-line-format)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
492 |
13053 | 493 (defun include-other-diary-files () |
494 "Include the diary entries from other diary files with those of diary-file. | |
495 This function is suitable for use in `list-diary-entries-hook'; | |
496 it enables you to use shared diary files together with your own. | |
497 The files included are specified in the diaryfile by lines of this form: | |
498 #include \"filename\" | |
499 This is recursive; that is, #include directives in diary files thus included | |
500 are obeyed. You can change the `#include' to some other string by | |
501 changing the variable `diary-include-string'." | |
502 (goto-char (point-min)) | |
503 (while (re-search-forward | |
504 (concat | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
505 "\\(?:\\`\\|\^M\\|\n\\)" |
13053 | 506 (regexp-quote diary-include-string) |
507 " \"\\([^\"]*\\)\"") | |
508 nil t) | |
27842
cfa579c1229f
(include-other-diary-files): Undo the selective
Gerd Moellmann <gerd@gnu.org>
parents:
26330
diff
changeset
|
509 (let* ((diary-file (substitute-in-file-name |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
510 (match-string-no-properties 1))) |
27842
cfa579c1229f
(include-other-diary-files): Undo the selective
Gerd Moellmann <gerd@gnu.org>
parents:
26330
diff
changeset
|
511 (diary-list-include-blanks nil) |
cfa579c1229f
(include-other-diary-files): Undo the selective
Gerd Moellmann <gerd@gnu.org>
parents:
26330
diff
changeset
|
512 (list-diary-entries-hook 'include-other-diary-files) |
cfa579c1229f
(include-other-diary-files): Undo the selective
Gerd Moellmann <gerd@gnu.org>
parents:
26330
diff
changeset
|
513 (diary-display-hook 'ignore) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
514 (diary-hook nil)) |
13053 | 515 (if (file-exists-p diary-file) |
516 (if (file-readable-p diary-file) | |
517 (unwind-protect | |
518 (setq diary-entries-list | |
519 (append diary-entries-list | |
520 (list-diary-entries original-date number))) | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
521 (with-current-buffer (find-buffer-visiting diary-file) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
522 (diary-unhide-everything))) |
13053 | 523 (beep) |
524 (message "Can't read included diary file %s" diary-file) | |
525 (sleep-for 2)) | |
526 (beep) | |
527 (message "Can't find included diary file %s" diary-file) | |
528 (sleep-for 2)))) | |
529 (goto-char (point-min))) | |
530 | |
531 (defun simple-diary-display () | |
532 "Display the diary buffer if there are any relevant entries or holidays." | |
533 (let* ((holiday-list (if holidays-in-diary-buffer | |
534 (check-calendar-holidays original-date))) | |
52319
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
535 (hol-string (format "%s%s%s" |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
536 date-string |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
537 (if holiday-list ": " "") |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
538 (mapconcat 'identity holiday-list "; "))) |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
539 (msg (format "No diary entries for %s" hol-string)) |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
540 ;; If selected window is dedicated (to the calendar), |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
541 ;; need a new one to display the diary. |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
542 (pop-up-frames (window-dedicated-p (selected-window)))) |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
543 (calendar-set-mode-line (format "Diary for %s" hol-string)) |
13053 | 544 (if (or (not diary-entries-list) |
545 (and (not (cdr diary-entries-list)) | |
546 (string-equal (car (cdr (car diary-entries-list))) ""))) | |
52319
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
547 (if (< (length msg) (frame-width)) |
14308
0ce52b2f2bb5
(simple-diary-display, fancy-diary-display): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
548 (message "%s" msg) |
13053 | 549 (set-buffer (get-buffer-create holiday-buffer)) |
550 (setq buffer-read-only nil) | |
551 (calendar-set-mode-line date-string) | |
552 (erase-buffer) | |
553 (insert (mapconcat 'identity holiday-list "\n")) | |
554 (goto-char (point-min)) | |
555 (set-buffer-modified-p nil) | |
556 (setq buffer-read-only t) | |
557 (display-buffer holiday-buffer) | |
558 (message "No diary entries for %s" date-string)) | |
57255 | 559 (with-current-buffer |
560 (find-buffer-visiting (substitute-in-file-name diary-file)) | |
561 (let ((window (display-buffer (current-buffer)))) | |
562 ;; d-s-p is passed from list-diary-entries. | |
563 (set-window-point window diary-saved-point) | |
564 (set-window-start window (point-min)))) | |
13053 | 565 (message "Preparing diary...done")))) |
566 | |
63222
cd220f7e47e7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Miles Bader <miles@gnu.org>
parents:
62925
diff
changeset
|
567 (defface diary-button '((((type pc) (class color)) |
cd220f7e47e7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Miles Bader <miles@gnu.org>
parents:
62925
diff
changeset
|
568 (:foreground "lightblue"))) |
48372
dedfe509d0ca
(diary-button-face): Add group and version number.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48365
diff
changeset
|
569 "Default face used for buttons." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59063
diff
changeset
|
570 :version "22.1" |
48372
dedfe509d0ca
(diary-button-face): Add group and version number.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48365
diff
changeset
|
571 :group 'diary) |
63222
cd220f7e47e7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Miles Bader <miles@gnu.org>
parents:
62925
diff
changeset
|
572 ;; backward-compatibility alias |
cd220f7e47e7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Miles Bader <miles@gnu.org>
parents:
62925
diff
changeset
|
573 (put 'diary-button-face 'face-alias 'diary-button) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
574 |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
575 (define-button-type 'diary-entry |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
576 'action #'diary-goto-entry |
63222
cd220f7e47e7
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Miles Bader <miles@gnu.org>
parents:
62925
diff
changeset
|
577 'face 'diary-button) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
578 |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
579 (defun diary-goto-entry (button) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
580 (let ((marker (button-get button 'marker))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
581 (when marker |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
582 (pop-to-buffer (marker-buffer marker)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
583 (goto-char (marker-position marker))))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
584 |
13053 | 585 (defun fancy-diary-display () |
586 "Prepare a diary buffer with relevant entries in a fancy, noneditable form. | |
587 This function is provided for optional use as the `diary-display-hook'." | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
588 (with-current-buffer ;; Turn off selective-display in the diary file's buffer. |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
589 (find-buffer-visiting (substitute-in-file-name diary-file)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
590 (diary-unhide-everything)) |
13053 | 591 (if (or (not diary-entries-list) |
592 (and (not (cdr diary-entries-list)) | |
593 (string-equal (car (cdr (car diary-entries-list))) ""))) | |
594 (let* ((holiday-list (if holidays-in-diary-buffer | |
595 (check-calendar-holidays original-date))) | |
596 (msg (format "No diary entries for %s %s" | |
597 (concat date-string (if holiday-list ":" "")) | |
598 (mapconcat 'identity holiday-list "; ")))) | |
599 (if (<= (length msg) (frame-width)) | |
14308
0ce52b2f2bb5
(simple-diary-display, fancy-diary-display): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
600 (message "%s" msg) |
13053 | 601 (set-buffer (get-buffer-create holiday-buffer)) |
602 (setq buffer-read-only nil) | |
603 (erase-buffer) | |
604 (insert (mapconcat 'identity holiday-list "\n")) | |
605 (goto-char (point-min)) | |
606 (set-buffer-modified-p nil) | |
607 (setq buffer-read-only t) | |
608 (display-buffer holiday-buffer) | |
609 (message "No diary entries for %s" date-string))) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
610 (with-current-buffer;; Prepare the fancy diary buffer. |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
611 (make-fancy-diary-buffer) |
13053 | 612 (setq buffer-read-only nil) |
613 (let ((entry-list diary-entries-list) | |
614 (holiday-list) | |
615 (holiday-list-last-month 1) | |
616 (holiday-list-last-year 1) | |
617 (date (list 0 0 0))) | |
618 (while entry-list | |
619 (if (not (calendar-date-equal date (car (car entry-list)))) | |
620 (progn | |
621 (setq date (car (car entry-list))) | |
622 (and holidays-in-diary-buffer | |
623 (calendar-date-compare | |
624 (list (list holiday-list-last-month | |
625 (calendar-last-day-of-month | |
626 holiday-list-last-month | |
627 holiday-list-last-year) | |
628 holiday-list-last-year)) | |
629 (list date)) | |
630 ;; We need to get the holidays for the next 3 months. | |
631 (setq holiday-list-last-month | |
632 (extract-calendar-month date)) | |
633 (setq holiday-list-last-year | |
634 (extract-calendar-year date)) | |
54127
35aa728a0635
Matthew Mundell <matt@mundell.ukfsn.org>
Glenn Morris <rgm@gnu.org>
parents:
54078
diff
changeset
|
635 (progn |
35aa728a0635
Matthew Mundell <matt@mundell.ukfsn.org>
Glenn Morris <rgm@gnu.org>
parents:
54078
diff
changeset
|
636 (increment-calendar-month |
35aa728a0635
Matthew Mundell <matt@mundell.ukfsn.org>
Glenn Morris <rgm@gnu.org>
parents:
54078
diff
changeset
|
637 holiday-list-last-month holiday-list-last-year 1) |
35aa728a0635
Matthew Mundell <matt@mundell.ukfsn.org>
Glenn Morris <rgm@gnu.org>
parents:
54078
diff
changeset
|
638 t) |
13053 | 639 (setq holiday-list |
640 (let ((displayed-month holiday-list-last-month) | |
641 (displayed-year holiday-list-last-year)) | |
642 (calendar-holiday-list))) | |
643 (increment-calendar-month | |
644 holiday-list-last-month holiday-list-last-year 1)) | |
645 (let* ((date-string (calendar-date-string date)) | |
646 (date-holiday-list | |
647 (let ((h holiday-list) | |
648 (d)) | |
649 ;; Make a list of all holidays for date. | |
650 (while h | |
651 (if (calendar-date-equal date (car (car h))) | |
652 (setq d (append d (cdr (car h))))) | |
653 (setq h (cdr h))) | |
654 d))) | |
655 (insert (if (= (point) (point-min)) "" ?\n) date-string) | |
656 (if date-holiday-list (insert ": ")) | |
14954
a9102c34a5b6
Fix length of separator string.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14687
diff
changeset
|
657 (let* ((l (current-column)) |
a9102c34a5b6
Fix length of separator string.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14687
diff
changeset
|
658 (longest 0)) |
28615
4c6883cb70ab
(fancy-diary-display, mark-diary-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28575
diff
changeset
|
659 (insert (mapconcat (lambda (x) |
4c6883cb70ab
(fancy-diary-display, mark-diary-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28575
diff
changeset
|
660 (if (< longest (length x)) |
4c6883cb70ab
(fancy-diary-display, mark-diary-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28575
diff
changeset
|
661 (setq longest (length x))) |
4c6883cb70ab
(fancy-diary-display, mark-diary-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28575
diff
changeset
|
662 x) |
14954
a9102c34a5b6
Fix length of separator string.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14687
diff
changeset
|
663 date-holiday-list |
a9102c34a5b6
Fix length of separator string.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14687
diff
changeset
|
664 (concat "\n" (make-string l ? )))) |
a9102c34a5b6
Fix length of separator string.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
14687
diff
changeset
|
665 (insert ?\n (make-string (+ l longest) ?=) ?\n))))) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
666 |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
667 (setq entry (car (cdr (car entry-list)))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
668 (if (< 0 (length entry)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
669 (progn |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
670 (if (nth 3 (car entry-list)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
671 (insert-button (concat entry "\n") |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
672 'marker (nth 3 (car entry-list)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
673 :type 'diary-entry) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
674 (insert entry ?\n)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
675 (save-excursion |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
676 (let* ((marks (nth 4 (car entry-list))) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
677 (temp-face (make-symbol |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
678 (apply |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
679 'concat "temp-face-" |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
680 (mapcar (lambda (sym) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
681 (if (stringp sym) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
682 sym |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
683 (symbol-name sym))) |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
684 marks)))) |
53557 | 685 (faceinfo marks)) |
686 (make-face temp-face) | |
53548
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
687 ;; Remove :face info from the marks, |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
688 ;; copy the face info into temp-face |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
689 (while (setq faceinfo (memq :face faceinfo)) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
690 (copy-face (read (nth 1 faceinfo)) temp-face) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
691 (setcar faceinfo nil) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
692 (setcar (cdr faceinfo) nil)) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
693 (setq marks (delq nil marks)) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
694 ;; Apply the font aspects. |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
695 (apply 'set-face-attribute temp-face nil marks) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
696 (search-backward entry) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
697 (overlay-put |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
698 (make-overlay (match-beginning 0) (match-end 0)) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
699 'face temp-face))))) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
700 (setq entry-list (cdr entry-list)))) |
13053 | 701 (set-buffer-modified-p nil) |
702 (goto-char (point-min)) | |
703 (setq buffer-read-only t) | |
704 (display-buffer fancy-diary-buffer) | |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
705 (fancy-diary-display-mode) |
54537 | 706 (calendar-set-mode-line date-string) |
13053 | 707 (message "Preparing diary...done")))) |
708 | |
709 (defun make-fancy-diary-buffer () | |
710 "Create and return the initial fancy diary buffer." | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
711 (with-current-buffer (get-buffer-create fancy-diary-buffer) |
13053 | 712 (setq buffer-read-only nil) |
713 (calendar-set-mode-line "Diary Entries") | |
714 (erase-buffer) | |
715 (set-buffer-modified-p nil) | |
716 (setq buffer-read-only t) | |
717 (get-buffer fancy-diary-buffer))) | |
718 | |
719 (defun print-diary-entries () | |
720 "Print a hard copy of the diary display. | |
721 | |
722 If the simple diary display is being used, prepare a temp buffer with the | |
723 visible lines of the diary buffer, add a heading line composed from the mode | |
724 line, print the temp buffer, and destroy it. | |
725 | |
726 If the fancy diary display is being used, just print the buffer. | |
727 | |
728 The hooks given by the variable `print-diary-entries-hook' are called to do | |
729 the actual printing." | |
730 (interactive) | |
731 (if (bufferp (get-buffer fancy-diary-buffer)) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
732 (with-current-buffer (get-buffer fancy-diary-buffer) |
13053 | 733 (run-hooks 'print-diary-entries-hook)) |
734 (let ((diary-buffer | |
13877
44149f0bf44a
Replaced all uses of get-file-buffer with find-buffer-visiting.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13688
diff
changeset
|
735 (find-buffer-visiting (substitute-in-file-name diary-file)))) |
13053 | 736 (if diary-buffer |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
737 (let ((temp-buffer (get-buffer-create " *Printable Diary Entries*")) |
13053 | 738 (heading)) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
739 (with-current-buffer diary-buffer |
13053 | 740 (setq heading |
741 (if (not (stringp mode-line-format)) | |
742 "All Diary Entries" | |
743 (string-match "^-*\\([^-].*[^-]\\)-*$" mode-line-format) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
744 (match-string 1 mode-line-format))) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
745 (let ((start (point-min)) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
746 end) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
747 (while |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
748 (progn |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
749 (setq end (next-single-char-property-change |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
750 start 'invisible)) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
751 (if (get-char-property start 'invisible) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
752 nil |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
753 (with-current-buffer temp-buffer |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
754 (insert-buffer-substring diary-buffer |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
755 start (or end (point-max))))) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
756 (setq start end) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
757 (and end (< end (point-max)))))) |
13053 | 758 (set-buffer temp-buffer) |
759 (goto-char (point-min)) | |
760 (insert heading "\n" | |
761 (make-string (length heading) ?=) "\n") | |
762 (run-hooks 'print-diary-entries-hook) | |
763 (kill-buffer temp-buffer))) | |
764 (error "You don't have a diary buffer!"))))) | |
765 | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
766 (define-obsolete-function-alias 'show-all-diary-entries 'diary-show-all-entries) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
767 (defun diary-show-all-entries () |
13053 | 768 "Show all of the diary entries in the diary file. |
769 This function gets rid of the selective display of the diary file so that | |
770 all entries, not just some, are visible. If there is no diary buffer, one | |
771 is created." | |
772 (interactive) | |
53557 | 773 (let ((d-file (diary-check-diary-file)) |
774 (pop-up-frames (window-dedicated-p (selected-window)))) | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
775 (with-current-buffer (or (find-buffer-visiting d-file) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
776 (find-file-noselect d-file t)) |
66869
cfc510b6c9e6
(diary-list-entries, diary-show-all-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66429
diff
changeset
|
777 (when (eq major-mode default-major-mode) (diary-mode)) |
65509
56d6dbdf0600
(diary-show-all-entries): Fix last change,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65476
diff
changeset
|
778 (diary-unhide-everything) |
56d6dbdf0600
(diary-show-all-entries): Fix last change,
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65476
diff
changeset
|
779 (display-buffer (current-buffer))))) |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
780 |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
781 (defcustom diary-mail-addr |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
782 (if (boundp 'user-mail-address) user-mail-address "") |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
783 "Email address that `diary-mail-entries' will send email to." |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
784 :group 'diary |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
785 :type 'string |
21668
621dd51298ec
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20354
diff
changeset
|
786 :version "20.3") |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
787 |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
788 (defcustom diary-mail-days 7 |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
789 "Default number of days for `diary-mail-entries' to check." |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
790 :group 'diary |
21668
621dd51298ec
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20354
diff
changeset
|
791 :type 'integer |
621dd51298ec
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20354
diff
changeset
|
792 :version "20.3") |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
793 |
21957
a74e1cee89bf
(diary-mail-entries): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
21893
diff
changeset
|
794 ;;;###autoload |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
795 (defun diary-mail-entries (&optional ndays) |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
796 "Send a mail message showing diary entries for next NDAYS days. |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
797 If no prefix argument is given, NDAYS is set to `diary-mail-days'. |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
798 Mail is sent to the address specified by `diary-mail-addr'. |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
799 |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
800 You can call `diary-mail-entries' every night using an at/cron job. |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
801 For example, this script will run the program at 2am daily. Since |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
802 `emacs -batch' does not load your `.emacs' file, you must ensure that |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
803 all relevant variables are set, as done here. |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
804 |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
805 #!/bin/sh |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
806 # diary-rem.sh -- repeatedly run the Emacs diary-reminder |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
807 emacs -batch \\ |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
808 -eval \"(setq diary-mail-days 3 \\ |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
809 diary-file \\\"/path/to/diary.file\\\" \\ |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
810 european-calendar-style t \\ |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
811 diary-mail-addr \\\"user@host.name\\\" )\" \\ |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
812 -l diary-lib -f diary-mail-entries |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
813 at -f diary-rem.sh 0200 tomorrow |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
814 |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
815 You may have to tweak the syntax of the `at' command to suit your |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
816 system. Alternatively, you can specify a cron entry: |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
817 0 1 * * * diary-rem.sh |
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
818 to run it every morning at 1am." |
35500
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
819 (interactive "P") |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
820 (if (string-equal diary-mail-addr "") |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
821 (error "You must set `diary-mail-addr' to use this command") |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
822 (let ((diary-display-hook 'fancy-diary-display)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
823 (list-diary-entries (calendar-current-date) (or ndays diary-mail-days))) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
824 (compose-mail diary-mail-addr |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
825 (concat "Diary entries generated " |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
826 (calendar-date-string (calendar-current-date)))) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
827 (insert |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
828 (if (get-buffer fancy-diary-buffer) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
829 (with-current-buffer fancy-diary-buffer (buffer-string)) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
830 "No entries found")) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
831 (call-interactively (get mail-user-agent 'sendfunc)))) |
20345
69818ee01344
(diary-mail-addr, diary-mail-days): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
20269
diff
changeset
|
832 |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
833 (defun diary-name-pattern (string-array &optional abbrev-array paren) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
834 "Return a regexp matching the strings in the array STRING-ARRAY. |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
835 If the optional argument ABBREV-ARRAY is present, then the function |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
836 `calendar-abbrev-construct' is used to construct abbreviations from the |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
837 two supplied arrays. The returned regexp will then also match these |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
838 abbreviations, with or without final `.' characters. If the optional |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
839 argument PAREN is non-nil, the regexp is surrounded by parentheses." |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
840 (regexp-opt (append string-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
841 (if abbrev-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
842 (calendar-abbrev-construct abbrev-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
843 string-array)) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
844 (if abbrev-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
845 (calendar-abbrev-construct abbrev-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
846 string-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
847 'period)) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
848 nil) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
849 paren)) |
13053 | 850 |
851 (defvar marking-diary-entries nil | |
852 "True during the marking of diary entries, nil otherwise.") | |
853 | |
854 (defvar marking-diary-entry nil | |
855 "True during the marking of diary entries, if current entry is marking.") | |
856 | |
60650
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
857 (defun mark-diary-entries (&optional redraw) |
13053 | 858 "Mark days in the calendar window that have diary entries. |
60650
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
859 Each entry in the diary file visible in the calendar window is |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
860 marked. After the entries are marked, the hooks |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
861 `nongregorian-diary-marking-hook' and `mark-diary-entries-hook' |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
862 are run. If the optional argument REDRAW is non-nil (which is |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
863 the case interactively, for example) then any existing diary |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
864 marks are first removed. This is intended to deal with deleted |
60650
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
865 diary entries." |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
866 (interactive "p") |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
867 ;; To remove any deleted diary entries. Do not redraw when: |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
868 ;; i) processing #include diary files (else only get the marks from |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
869 ;; the last #include file processed). |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
870 ;; ii) called via calendar-redraw (since calendar has already been |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
871 ;; erased). |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
872 ;; Use of REDRAW handles both of these cases. |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
873 (when (and redraw mark-diary-entries-in-calendar) |
60321
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
874 (setq mark-diary-entries-in-calendar nil) |
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
875 (redraw-calendar)) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
876 (let ((marking-diary-entries t) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
877 file-glob-attrs marks) |
65619
e09cff91900a
(mark-diary-entries): Revert last change.
Romain Francoise <romain@orebokech.com>
parents:
65597
diff
changeset
|
878 (with-current-buffer (find-file-noselect (diary-check-diary-file) t) |
e09cff91900a
(mark-diary-entries): Revert last change.
Romain Francoise <romain@orebokech.com>
parents:
65597
diff
changeset
|
879 (save-excursion |
66869
cfc510b6c9e6
(diary-list-entries, diary-show-all-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66429
diff
changeset
|
880 (when (eq major-mode default-major-mode) (diary-mode)) |
65552
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
881 (setq mark-diary-entries-in-calendar t) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
882 (message "Marking diary entries...") |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
883 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
884 (with-syntax-table diary-syntax-table |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
885 (dolist (date-form diary-date-forms) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
886 (if (eq (car date-form) 'backup) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
887 (setq date-form (cdr date-form))) ;; ignore 'backup directive |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
888 (let* ((dayname |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
889 (diary-name-pattern calendar-day-name-array |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
890 calendar-day-abbrev-array)) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
891 (monthname |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
892 (format "%s\\|\\*" |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
893 (diary-name-pattern calendar-month-name-array |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
894 calendar-month-abbrev-array))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
895 (month "[0-9]+\\|\\*") |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
896 (day "[0-9]+\\|\\*") |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
897 (year "[0-9]+\\|\\*") |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
898 (l (length date-form)) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
899 (d-name-pos (- l (length (memq 'dayname date-form)))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
900 (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
901 (m-name-pos (- l (length (memq 'monthname date-form)))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
902 (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
903 (d-pos (- l (length (memq 'day date-form)))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
904 (d-pos (if (/= l d-pos) (+ 2 d-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
905 (m-pos (- l (length (memq 'month date-form)))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
906 (m-pos (if (/= l m-pos) (+ 2 m-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
907 (y-pos (- l (length (memq 'year date-form)))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
908 (y-pos (if (/= l y-pos) (+ 2 y-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
909 (regexp |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
910 (concat |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
911 "\\(\\`\\|\^M\\|\n\\)\\(" |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
912 (mapconcat 'eval date-form "\\)\\(") |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
913 "\\)")) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
914 (case-fold-search t)) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
915 (goto-char (point-min)) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
916 (while (re-search-forward regexp nil t) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
917 (let* ((dd-name |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
918 (if d-name-pos |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
919 (match-string-no-properties d-name-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
920 (mm-name |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
921 (if m-name-pos |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
922 (match-string-no-properties m-name-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
923 (mm (string-to-number |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
924 (if m-pos |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
925 (match-string-no-properties m-pos) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
926 ""))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
927 (dd (string-to-number |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
928 (if d-pos |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
929 (match-string-no-properties d-pos) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
930 ""))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
931 (y-str (if y-pos |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
932 (match-string-no-properties y-pos))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
933 (yy (if (not y-str) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
934 0 |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
935 (if (and (= (length y-str) 2) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
936 abbreviated-calendar-year) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
937 (let* ((current-y |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
938 (extract-calendar-year |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
939 (calendar-current-date))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
940 (y (+ (string-to-number y-str) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
941 (* 100 |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
942 (/ current-y 100))))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
943 (if (> (- y current-y) 50) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
944 (- y 100) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
945 (if (> (- current-y y) 50) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
946 (+ y 100) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
947 y))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
948 (string-to-number y-str))))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
949 (let ((tmp (diary-pull-attrs (buffer-substring-no-properties |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
950 (point) (line-end-position)) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
951 file-glob-attrs))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
952 (setq entry (nth 0 tmp) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
953 marks (nth 1 tmp))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
954 (if dd-name |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
955 (mark-calendar-days-named |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
956 (cdr (assoc-string |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
957 dd-name |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
958 (calendar-make-alist |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
959 calendar-day-name-array |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
960 0 nil calendar-day-abbrev-array) t)) marks) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
961 (if mm-name |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
962 (setq mm |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
963 (if (string-equal mm-name "*") 0 |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
964 (cdr (assoc-string |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
965 mm-name |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
966 (calendar-make-alist |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
967 calendar-month-name-array |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
968 1 nil calendar-month-abbrev-array) t))))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
969 (mark-calendar-date-pattern mm dd yy marks)))))) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
970 (mark-sexp-diary-entries) |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
971 (run-hooks 'nongregorian-diary-marking-hook |
2f26d67eea8d
(mark-diary-entries): Don't move point. Use with-syntax-table and dolist.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65509
diff
changeset
|
972 'mark-diary-entries-hook)) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
973 (message "Marking diary entries...done"))))) |
13053 | 974 |
975 (defun mark-sexp-diary-entries () | |
976 "Mark days in the calendar window that have sexp diary entries. | |
977 Each entry in the diary file (or included files) visible in the calendar window | |
978 is marked. See the documentation for the function `list-sexp-diary-entries'." | |
979 (let* ((sexp-mark (regexp-quote sexp-diary-entry-symbol)) | |
980 (s-entry (concat "\\(\\`\\|\^M\\|\n\\)\\(" | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
981 sexp-mark "(\\)\\|\\(" |
13053 | 982 (regexp-quote diary-nonmarking-symbol) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
983 sexp-mark "(diary-remind\\)")) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
984 (file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
985 m y first-date last-date mark file-glob-attrs) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
986 (with-current-buffer calendar-buffer |
13053 | 987 (setq m displayed-month) |
988 (setq y displayed-year)) | |
989 (increment-calendar-month m y -1) | |
990 (setq first-date | |
991 (calendar-absolute-from-gregorian (list m 1 y))) | |
992 (increment-calendar-month m y 2) | |
993 (setq last-date | |
994 (calendar-absolute-from-gregorian | |
995 (list m (calendar-last-day-of-month m y) y))) | |
996 (goto-char (point-min)) | |
997 (while (re-search-forward s-entry nil t) | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
998 (setq marking-diary-entry (char-equal (preceding-char) ?\()) |
13053 | 999 (re-search-backward "(") |
1000 (let ((sexp-start (point)) | |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1001 sexp entry entry-start line-start marks) |
13053 | 1002 (forward-sexp) |
13687
9a985bcde00e
Chnaged all occurrences of buffer-substring to buffer-substring-no-properties.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13670
diff
changeset
|
1003 (setq sexp (buffer-substring-no-properties sexp-start (point))) |
13053 | 1004 (save-excursion |
1005 (re-search-backward "\^M\\|\n\\|\\`") | |
1006 (setq line-start (point))) | |
1007 (forward-char 1) | |
1008 (if (and (or (char-equal (preceding-char) ?\^M) | |
1009 (char-equal (preceding-char) ?\n)) | |
1010 (not (looking-at " \\|\^I"))) | |
1011 (progn;; Diary entry consists only of the sexp | |
1012 (backward-char 1) | |
1013 (setq entry "")) | |
1014 (setq entry-start (point)) | |
23247
1f91824c4087
(mark-sexp-diary-entries): Fix previous chg.
Karl Heuer <kwzh@gnu.org>
parents:
23232
diff
changeset
|
1015 ;; Find end of entry |
13053 | 1016 (re-search-forward "\^M\\|\n" nil t) |
1017 (while (looking-at " \\|\^I") | |
23232
97332957a969
(mark-sexp-diary-entries): Avoid infinite loop when
Karl Heuer <kwzh@gnu.org>
parents:
23122
diff
changeset
|
1018 (or (re-search-forward "\^M\\|\n" nil t) |
97332957a969
(mark-sexp-diary-entries): Avoid infinite loop when
Karl Heuer <kwzh@gnu.org>
parents:
23122
diff
changeset
|
1019 (re-search-forward "$" nil t))) |
23247
1f91824c4087
(mark-sexp-diary-entries): Fix previous chg.
Karl Heuer <kwzh@gnu.org>
parents:
23232
diff
changeset
|
1020 (if (or (char-equal (preceding-char) ?\^M) |
1f91824c4087
(mark-sexp-diary-entries): Fix previous chg.
Karl Heuer <kwzh@gnu.org>
parents:
23232
diff
changeset
|
1021 (char-equal (preceding-char) ?\n)) |
1f91824c4087
(mark-sexp-diary-entries): Fix previous chg.
Karl Heuer <kwzh@gnu.org>
parents:
23232
diff
changeset
|
1022 (backward-char 1)) |
13687
9a985bcde00e
Chnaged all occurrences of buffer-substring to buffer-substring-no-properties.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13670
diff
changeset
|
1023 (setq entry (buffer-substring-no-properties entry-start (point))) |
13053 | 1024 (while (string-match "[\^M]" entry) |
1025 (aset entry (match-beginning 0) ?\n ))) | |
1026 (calendar-for-loop date from first-date to last-date do | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1027 (if (setq mark (diary-sexp-entry sexp entry |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1028 (calendar-gregorian-from-absolute date))) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1029 (progn |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1030 (setq marks (diary-pull-attrs entry file-glob-attrs) |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1031 marks (nth 1 (diary-pull-attrs entry file-glob-attrs))) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1032 (mark-visible-calendar-date |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
1033 (calendar-gregorian-from-absolute date) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1034 (if (< 0 (length marks)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1035 marks |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1036 (if (consp mark) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1037 (car mark))))))))))) |
13053 | 1038 |
1039 (defun mark-included-diary-files () | |
1040 "Mark the diary entries from other diary files with those of the diary file. | |
1041 This function is suitable for use as the `mark-diary-entries-hook'; it enables | |
1042 you to use shared diary files together with your own. The files included are | |
1043 specified in the diary-file by lines of this form: | |
1044 #include \"filename\" | |
1045 This is recursive; that is, #include directives in diary files thus included | |
1046 are obeyed. You can change the `#include' to some other string by | |
1047 changing the variable `diary-include-string'." | |
1048 (goto-char (point-min)) | |
1049 (while (re-search-forward | |
1050 (concat | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1051 "\\(?:\\`\\|\^M\\|\n\\)" |
13053 | 1052 (regexp-quote diary-include-string) |
1053 " \"\\([^\"]*\\)\"") | |
1054 nil t) | |
62901
555a704ce217
(mark-included-diary-files): Only kill included diary buffer if it was
Glenn Morris <rgm@gnu.org>
parents:
62402
diff
changeset
|
1055 (let* ((diary-file (substitute-in-file-name |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1056 (match-string-no-properties 1))) |
62901
555a704ce217
(mark-included-diary-files): Only kill included diary buffer if it was
Glenn Morris <rgm@gnu.org>
parents:
62402
diff
changeset
|
1057 (mark-diary-entries-hook 'mark-included-diary-files) |
555a704ce217
(mark-included-diary-files): Only kill included diary buffer if it was
Glenn Morris <rgm@gnu.org>
parents:
62402
diff
changeset
|
1058 (dbuff (find-buffer-visiting diary-file))) |
13053 | 1059 (if (file-exists-p diary-file) |
1060 (if (file-readable-p diary-file) | |
1061 (progn | |
1062 (mark-diary-entries) | |
62901
555a704ce217
(mark-included-diary-files): Only kill included diary buffer if it was
Glenn Morris <rgm@gnu.org>
parents:
62402
diff
changeset
|
1063 (unless dbuff |
555a704ce217
(mark-included-diary-files): Only kill included diary buffer if it was
Glenn Morris <rgm@gnu.org>
parents:
62402
diff
changeset
|
1064 (kill-buffer (find-buffer-visiting diary-file)))) |
13053 | 1065 (beep) |
1066 (message "Can't read included diary file %s" diary-file) | |
1067 (sleep-for 2)) | |
1068 (beep) | |
1069 (message "Can't find included diary file %s" diary-file) | |
1070 (sleep-for 2)))) | |
1071 (goto-char (point-min))) | |
1072 | |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1073 (defun mark-calendar-days-named (dayname &optional color) |
13053 | 1074 "Mark all dates in the calendar window that are day DAYNAME of the week. |
1075 0 means all Sundays, 1 means all Mondays, and so on." | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1076 (with-current-buffer calendar-buffer |
13053 | 1077 (let ((prev-month displayed-month) |
1078 (prev-year displayed-year) | |
1079 (succ-month displayed-month) | |
1080 (succ-year displayed-year) | |
1081 (last-day) | |
1082 (day)) | |
1083 (increment-calendar-month succ-month succ-year 1) | |
1084 (increment-calendar-month prev-month prev-year -1) | |
1085 (setq day (calendar-absolute-from-gregorian | |
1086 (calendar-nth-named-day 1 dayname prev-month prev-year))) | |
1087 (setq last-day (calendar-absolute-from-gregorian | |
1088 (calendar-nth-named-day -1 dayname succ-month succ-year))) | |
1089 (while (<= day last-day) | |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1090 (mark-visible-calendar-date (calendar-gregorian-from-absolute day) color) |
13053 | 1091 (setq day (+ day 7)))))) |
1092 | |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1093 (defun mark-calendar-date-pattern (month day year &optional color) |
13053 | 1094 "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR. |
1095 A value of 0 in any position is a wildcard." | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1096 (with-current-buffer calendar-buffer |
13053 | 1097 (let ((m displayed-month) |
1098 (y displayed-year)) | |
1099 (increment-calendar-month m y -1) | |
1100 (calendar-for-loop i from 0 to 2 do | |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1101 (mark-calendar-month m y month day year color) |
13053 | 1102 (increment-calendar-month m y 1))))) |
1103 | |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1104 (defun mark-calendar-month (month year p-month p-day p-year &optional color) |
13053 | 1105 "Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P_DAY/P-YEAR. |
1106 A value of 0 in any position of the pattern is a wildcard." | |
1107 (if (or (and (= month p-month) | |
1108 (or (= p-year 0) (= year p-year))) | |
1109 (and (= p-month 0) | |
1110 (or (= p-year 0) (= year p-year)))) | |
1111 (if (= p-day 0) | |
1112 (calendar-for-loop | |
1113 i from 1 to (calendar-last-day-of-month month year) do | |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1114 (mark-visible-calendar-date (list month i year) color)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1115 (mark-visible-calendar-date (list month p-day year) color)))) |
13053 | 1116 |
1117 (defun sort-diary-entries () | |
1118 "Sort the list of diary entries by time of day." | |
1119 (setq diary-entries-list (sort diary-entries-list 'diary-entry-compare))) | |
1120 | |
1121 (defun diary-entry-compare (e1 e2) | |
1122 "Returns t if E1 is earlier than E2." | |
1123 (or (calendar-date-compare e1 e2) | |
1124 (and (calendar-date-equal (car e1) (car e2)) | |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1125 (let* ((ts1 (cadr e1)) (t1 (diary-entry-time ts1)) |
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1126 (ts2 (cadr e2)) (t2 (diary-entry-time ts2))) |
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1127 (or (< t1 t2) |
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1128 (and (= t1 t2) |
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1129 (string-lessp ts1 ts2))))))) |
13053 | 1130 |
20269
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1131 (defcustom diary-unknown-time |
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1132 -9999 |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1133 "Value returned by diary-entry-time when no time is found. |
20269
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1134 The default value -9999 causes entries with no recognizable time to be placed |
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1135 before those with times; 9999 would place entries with no recognizable time |
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1136 after those with times." |
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1137 :type 'integer |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21668
diff
changeset
|
1138 :group 'diary |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21668
diff
changeset
|
1139 :version "20.3") |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1140 |
13053 | 1141 (defun diary-entry-time (s) |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1142 "Return time at the beginning of the string S as a military-style integer. |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1143 For example, returns 1325 for 1:25pm. |
53548
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1144 |
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1145 Returns `diary-unknown-time' (default value -9999) if no time is recognized. |
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1146 The recognized forms are XXXX, X:XX, or XX:XX (military time), and XXam, |
53557 | 1147 XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, or XX:XXPM. A period (.) can |
1148 be used instead of a colon (:) to separate the hour and minute parts." | |
19324
02a8fe146fa6
(diary-entry-time): Bind case-fold-search to nil.
Richard M. Stallman <rms@gnu.org>
parents:
18922
diff
changeset
|
1149 (let ((case-fold-search nil)) |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1150 (cond ((string-match ; Military time |
53548
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1151 "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" |
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1152 s) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1153 (+ (* 100 (string-to-number (match-string 1 s))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1154 (string-to-number (match-string 2 s)))) |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1155 ((string-match ; Hour only XXam or XXpm |
34036
c2a8edb5b5ec
(diary-entry-time): Anchor pattern correctly
Gerd Moellmann <gerd@gnu.org>
parents:
32415
diff
changeset
|
1156 "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1157 (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) |
19324
02a8fe146fa6
(diary-entry-time): Bind case-fold-search to nil.
Richard M. Stallman <rms@gnu.org>
parents:
18922
diff
changeset
|
1158 (if (equal ?a (downcase (aref s (match-beginning 2)))) |
02a8fe146fa6
(diary-entry-time): Bind case-fold-search to nil.
Richard M. Stallman <rms@gnu.org>
parents:
18922
diff
changeset
|
1159 0 1200))) |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1160 ((string-match ; Hour and minute XX:XXam or XX:XXpm |
53613
2f99823b0a96
(diary-entry-time): Fix typo/bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
53557
diff
changeset
|
1161 "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1162 (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1163 (string-to-number (match-string 2 s)) |
19324
02a8fe146fa6
(diary-entry-time): Bind case-fold-search to nil.
Richard M. Stallman <rms@gnu.org>
parents:
18922
diff
changeset
|
1164 (if (equal ?a (downcase (aref s (match-beginning 3)))) |
02a8fe146fa6
(diary-entry-time): Bind case-fold-search to nil.
Richard M. Stallman <rms@gnu.org>
parents:
18922
diff
changeset
|
1165 0 1200))) |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1166 (t diary-unknown-time)))) ; Unrecognizable |
34036
c2a8edb5b5ec
(diary-entry-time): Anchor pattern correctly
Gerd Moellmann <gerd@gnu.org>
parents:
32415
diff
changeset
|
1167 |
55431
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
1168 ;; Unrecognizable |
b278cb498cc8
2004-05-08 John Wiegley <johnw@newartisans.com>
John Wiegley <johnw@newartisans.com>
parents:
55249
diff
changeset
|
1169 |
13053 | 1170 (defun list-sexp-diary-entries (date) |
1171 "Add sexp entries for DATE from the diary file to `diary-entries-list'. | |
1172 Also, Make them visible in the diary file. Returns t if any entries were | |
1173 found. | |
1174 | |
1175 Sexp diary entries must be prefaced by a `sexp-diary-entry-symbol' (normally | |
1176 `%%'). The form of a sexp diary entry is | |
1177 | |
1178 %%(SEXP) ENTRY | |
1179 | |
1180 Both ENTRY and DATE are globally available when the SEXP is evaluated. If the | |
1181 SEXP yields the value nil, the diary entry does not apply. If it yields a | |
1182 non-nil value, ENTRY will be taken to apply to DATE; if the non-nil value is a | |
1183 string, that string will be the diary entry in the fancy diary display. | |
1184 | |
1185 For example, the following diary entry will apply to the 21st of the month | |
1186 if it is a weekday and the Friday before if the 21st is on a weekend: | |
1187 | |
1188 &%%(let ((dayname (calendar-day-of-week date)) | |
1189 (day (extract-calendar-day date))) | |
1190 (or | |
1191 (and (= day 21) (memq dayname '(1 2 3 4 5))) | |
1192 (and (memq day '(19 20)) (= dayname 5))) | |
1193 ) UIUC pay checks deposited | |
1194 | |
1195 A number of built-in functions are available for this type of diary entry: | |
1196 | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1197 %%(diary-date MONTH DAY YEAR &optional MARK) text |
13053 | 1198 Entry applies if date is MONTH, DAY, YEAR if |
1199 `european-calendar-style' is nil, and DAY, MONTH, YEAR if | |
1200 `european-calendar-style' is t. DAY, MONTH, and YEAR | |
1201 can be lists of integers, the constant t, or an integer. | |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1202 The constant t means all values. An optional parameter |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1203 MARK specifies a face or single-character string to use |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1204 when highlighting the day in the calendar. |
13053 | 1205 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1206 %%(diary-float MONTH DAYNAME N &optional DAY MARK) text |
13053 | 1207 Entry will appear on the Nth DAYNAME of MONTH. |
1208 (DAYNAME=0 means Sunday, 1 means Monday, and so on; | |
1209 if N is negative it counts backward from the end of | |
1210 the month. MONTH can be a list of months, a single | |
17892
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1211 month, or t to specify all months. Optional DAY means |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1212 Nth DAYNAME of MONTH on or after/before DAY. DAY defaults |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1213 to 1 if N>0 and the last day of the month if N<0. An |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1214 optional parameter MARK specifies a face or single-character |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1215 string to use when highlighting the day in the calendar. |
13053 | 1216 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1217 %%(diary-block M1 D1 Y1 M2 D2 Y2 &optional MARK) text |
13053 | 1218 Entry will appear on dates between M1/D1/Y1 and M2/D2/Y2, |
1219 inclusive. (If `european-calendar-style' is t, the | |
1220 order of the parameters should be changed to D1, M1, Y1, | |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1221 D2, M2, Y2.) An optional parameter MARK specifies a face |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1222 or single-character string to use when highlighting the |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1223 day in the calendar. |
13053 | 1224 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1225 %%(diary-anniversary MONTH DAY YEAR &optional MARK) text |
13053 | 1226 Entry will appear on anniversary dates of MONTH DAY, YEAR. |
1227 (If `european-calendar-style' is t, the order of the | |
1228 parameters should be changed to DAY, MONTH, YEAR.) Text | |
1229 can contain %d or %d%s; %d will be replaced by the number | |
1230 of years since the MONTH DAY, YEAR and %s will be replaced | |
1231 by the ordinal ending of that number (that is, `st', `nd', | |
1232 `rd' or `th', as appropriate. The anniversary of February | |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1233 29 is considered to be March 1 in a non-leap year. An |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1234 optional parameter MARK specifies a face or single-character |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1235 string to use when highlighting the day in the calendar. |
13053 | 1236 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1237 %%(diary-cyclic N MONTH DAY YEAR &optional MARK) text |
13053 | 1238 Entry will appear every N days, starting MONTH DAY, YEAR. |
1239 (If `european-calendar-style' is t, the order of the | |
1240 parameters should be changed to N, DAY, MONTH, YEAR.) Text | |
1241 can contain %d or %d%s; %d will be replaced by the number | |
1242 of repetitions since the MONTH DAY, YEAR and %s will | |
1243 be replaced by the ordinal ending of that number (that is, | |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1244 `st', `nd', `rd' or `th', as appropriate. An optional |
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1245 parameter MARK specifies a face or single-character string |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1246 to use when highlighting the day in the calendar. |
13053 | 1247 |
1248 %%(diary-remind SEXP DAYS &optional MARKING) text | |
1249 Entry is a reminder for diary sexp SEXP. DAYS is either a | |
1250 single number or a list of numbers indicating the number(s) | |
1251 of days before the event that the warning(s) should occur. | |
1252 If the current date is (one of) DAYS before the event | |
1253 indicated by EXPR, then a suitable message (as specified | |
1254 by `diary-remind-message') appears. In addition to the | |
1255 reminders beforehand, the diary entry also appears on | |
1256 the date itself. If optional MARKING is non-nil then the | |
1257 *reminders* are marked on the calendar. Marking of | |
1258 reminders is independent of whether the entry *itself* is | |
1259 a marking or nonmarking one. | |
1260 | |
1261 %%(diary-day-of-year) | |
1262 Diary entries giving the day of the year and the number of | |
1263 days remaining in the year will be made every day. Note | |
1264 that since there is no text, it makes sense only if the | |
1265 fancy diary display is used. | |
1266 | |
1267 %%(diary-iso-date) | |
1268 Diary entries giving the corresponding ISO commercial date | |
1269 will be made every day. Note that since there is no text, | |
1270 it makes sense only if the fancy diary display is used. | |
1271 | |
1272 %%(diary-french-date) | |
1273 Diary entries giving the corresponding French Revolutionary | |
1274 date will be made every day. Note that since there is no | |
1275 text, it makes sense only if the fancy diary display is used. | |
1276 | |
1277 %%(diary-islamic-date) | |
1278 Diary entries giving the corresponding Islamic date will be | |
1279 made every day. Note that since there is no text, it | |
1280 makes sense only if the fancy diary display is used. | |
1281 | |
1282 %%(diary-hebrew-date) | |
1283 Diary entries giving the corresponding Hebrew date will be | |
1284 made every day. Note that since there is no text, it | |
1285 makes sense only if the fancy diary display is used. | |
1286 | |
1287 %%(diary-astro-day-number) Diary entries giving the corresponding | |
1288 astronomical (Julian) day number will be made every day. | |
1289 Note that since there is no text, it makes sense only if the | |
1290 fancy diary display is used. | |
1291 | |
1292 %%(diary-julian-date) Diary entries giving the corresponding | |
1293 Julian date will be made every day. Note that since | |
1294 there is no text, it makes sense only if the fancy diary | |
1295 display is used. | |
1296 | |
1297 %%(diary-sunrise-sunset) | |
1298 Diary entries giving the local times of sunrise and sunset | |
1299 will be made every day. Note that since there is no text, | |
1300 it makes sense only if the fancy diary display is used. | |
1301 Floating point required. | |
1302 | |
1303 %%(diary-phases-of-moon) | |
1304 Diary entries giving the times of the phases of the moon | |
1305 will be when appropriate. Note that since there is no text, | |
1306 it makes sense only if the fancy diary display is used. | |
1307 Floating point required. | |
1308 | |
1309 %%(diary-yahrzeit MONTH DAY YEAR) text | |
1310 Text is assumed to be the name of the person; the date is | |
1311 the date of death on the *civil* calendar. The diary entry | |
1312 will appear on the proper Hebrew-date anniversary and on the | |
1313 day before. (If `european-calendar-style' is t, the order | |
1314 of the parameters should be changed to DAY, MONTH, YEAR.) | |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1315 |
13053 | 1316 %%(diary-rosh-hodesh) |
1317 Diary entries will be made on the dates of Rosh Hodesh on | |
1318 the Hebrew calendar. Note that since there is no text, it | |
1319 makes sense only if the fancy diary display is used. | |
1320 | |
1321 %%(diary-parasha) | |
1322 Diary entries giving the weekly parasha will be made on | |
1323 every Saturday. Note that since there is no text, it | |
1324 makes sense only if the fancy diary display is used. | |
1325 | |
1326 %%(diary-omer) | |
1327 Diary entries giving the omer count will be made every day | |
13670
15c441f6d41a
(list-sexp-diary-entries): Doc fix.
Paul Eggert <eggert@twinsun.com>
parents:
13650
diff
changeset
|
1328 from Passover to Shavuot. Note that since there is no text, |
13053 | 1329 it makes sense only if the fancy diary display is used. |
1330 | |
1331 Marking these entries is *extremely* time consuming, so these entries are | |
1332 best if they are nonmarking." | |
53548
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1333 (let ((s-entry (concat "\\(\\`\\|\^M\\|\n\\)" |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1334 (regexp-quote diary-nonmarking-symbol) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1335 "?" |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1336 (regexp-quote sexp-diary-entry-symbol) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1337 "(")) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1338 entry-found file-glob-attrs marks) |
13053 | 1339 (goto-char (point-min)) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1340 (save-excursion |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1341 (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))) |
13053 | 1342 (while (re-search-forward s-entry nil t) |
1343 (backward-char 1) | |
1344 (let ((sexp-start (point)) | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1345 sexp entry specifier entry-start line-start) |
13053 | 1346 (forward-sexp) |
13687
9a985bcde00e
Chnaged all occurrences of buffer-substring to buffer-substring-no-properties.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13670
diff
changeset
|
1347 (setq sexp (buffer-substring-no-properties sexp-start (point))) |
13053 | 1348 (save-excursion |
1349 (re-search-backward "\^M\\|\n\\|\\`") | |
1350 (setq line-start (point))) | |
20269
ca337d0a1553
(list-diary-entries, list-sexp-diary-entries, add-to-diary-list):
Karl Heuer <kwzh@gnu.org>
parents:
19324
diff
changeset
|
1351 (setq specifier |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1352 (buffer-substring-no-properties (1+ line-start) (point)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1353 entry-start (1+ line-start)) |
13053 | 1354 (forward-char 1) |
1355 (if (and (or (char-equal (preceding-char) ?\^M) | |
1356 (char-equal (preceding-char) ?\n)) | |
1357 (not (looking-at " \\|\^I"))) | |
1358 (progn;; Diary entry consists only of the sexp | |
1359 (backward-char 1) | |
1360 (setq entry "")) | |
1361 (setq entry-start (point)) | |
1362 (re-search-forward "\^M\\|\n" nil t) | |
1363 (while (looking-at " \\|\^I") | |
1364 (re-search-forward "\^M\\|\n" nil t)) | |
1365 (backward-char 1) | |
13687
9a985bcde00e
Chnaged all occurrences of buffer-substring to buffer-substring-no-properties.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13670
diff
changeset
|
1366 (setq entry (buffer-substring-no-properties entry-start (point))) |
13053 | 1367 (while (string-match "[\^M]" entry) |
1368 (aset entry (match-beginning 0) ?\n ))) | |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1369 (let ((diary-entry (diary-sexp-entry sexp entry date)) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1370 temp) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1371 (setq entry (if (consp diary-entry) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1372 (cdr diary-entry) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1373 diary-entry)) |
13053 | 1374 (if diary-entry |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1375 (progn |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1376 (remove-overlays line-start (point) 'invisible 'diary) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1377 (if (< 0 (length entry)) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1378 (setq temp (diary-pull-attrs entry file-glob-attrs) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1379 entry (nth 0 temp) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1380 marks (nth 1 temp))))) |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1381 (add-to-diary-list date |
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1382 entry |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1383 specifier |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1384 (if entry-start (copy-marker entry-start) |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
1385 nil) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1386 marks) |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1387 (setq entry-found (or entry-found diary-entry))))) |
13053 | 1388 entry-found)) |
1389 | |
1390 (defun diary-sexp-entry (sexp entry date) | |
1391 "Process a SEXP diary ENTRY for DATE." | |
1392 (let ((result (if calendar-debug-sexp | |
1393 (let ((stack-trace-on-error t)) | |
1394 (eval (car (read-from-string sexp)))) | |
1395 (condition-case nil | |
1396 (eval (car (read-from-string sexp))) | |
1397 (error | |
1398 (beep) | |
1399 (message "Bad sexp at line %d in %s: %s" | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1400 (count-lines (point-min) (point)) |
13053 | 1401 diary-file sexp) |
1402 (sleep-for 2)))))) | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1403 (cond ((stringp result) result) |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1404 ((and (consp result) |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1405 (stringp (cdr result))) result) |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1406 (result entry) |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1407 (t nil)))) |
13053 | 1408 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1409 (defun diary-date (month day year &optional mark) |
13053 | 1410 "Specific date(s) diary entry. |
1411 Entry applies if date is MONTH, DAY, YEAR if `european-calendar-style' is nil, | |
1412 and DAY, MONTH, YEAR if `european-calendar-style' is t. DAY, MONTH, and YEAR | |
1413 can be lists of integers, the constant t, or an integer. The constant t means | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1414 all values. |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1415 |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1416 An optional parameter MARK specifies a face or single-character string to |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1417 use when highlighting the day in the calendar." |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1418 (let ((dd (if european-calendar-style |
13053 | 1419 month |
1420 day)) | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1421 (mm (if european-calendar-style |
13053 | 1422 day |
1423 month)) | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1424 (m (extract-calendar-month date)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1425 (y (extract-calendar-year date)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1426 (d (extract-calendar-day date))) |
13053 | 1427 (if (and |
1428 (or (and (listp dd) (memq d dd)) | |
1429 (equal d dd) | |
1430 (eq dd t)) | |
1431 (or (and (listp mm) (memq m mm)) | |
1432 (equal m mm) | |
1433 (eq mm t)) | |
1434 (or (and (listp year) (memq y year)) | |
1435 (equal y year) | |
1436 (eq year t))) | |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1437 (cons mark entry)))) |
13053 | 1438 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1439 (defun diary-block (m1 d1 y1 m2 d2 y2 &optional mark) |
13053 | 1440 "Block diary entry. |
42513
22938e0c54b2
(diary-block): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41566
diff
changeset
|
1441 Entry applies if date is between, or on one of, two dates. |
22938e0c54b2
(diary-block): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41566
diff
changeset
|
1442 The order of the parameters is |
23122 | 1443 M1, D1, Y1, M2, D2, Y2 if `european-calendar-style' is nil, and |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1444 D1, M1, Y1, D2, M2, Y2 if `european-calendar-style' is t. |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1445 |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1446 An optional parameter MARK specifies a face or single-character string to |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1447 use when highlighting the day in the calendar." |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1448 |
13053 | 1449 (let ((date1 (calendar-absolute-from-gregorian |
1450 (if european-calendar-style | |
1451 (list d1 m1 y1) | |
1452 (list m1 d1 y1)))) | |
1453 (date2 (calendar-absolute-from-gregorian | |
1454 (if european-calendar-style | |
1455 (list d2 m2 y2) | |
1456 (list m2 d2 y2)))) | |
1457 (d (calendar-absolute-from-gregorian date))) | |
1458 (if (and (<= date1 d) (<= d date2)) | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1459 (cons mark entry)))) |
13053 | 1460 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1461 (defun diary-float (month dayname n &optional day mark) |
13053 | 1462 "Floating diary entry--entry applies if date is the nth dayname of month. |
1463 Parameters are MONTH, DAYNAME, N. MONTH can be a list of months, the constant | |
1464 t, or an integer. The constant t means all months. If N is negative, count | |
17892
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1465 backward from the end of the month. |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1466 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1467 An optional parameter DAY means the Nth DAYNAME on or after/before MONTH DAY. |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1468 Optional MARK specifies a face or single-character string to use when |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1469 highlighting the day in the calendar." |
17892
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1470 ;; This is messy because the diary entry may apply, but the date on which it |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1471 ;; is based can be in a different month/year. For example, asking for the |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1472 ;; first Monday after December 30. For large values of |n| the problem is |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1473 ;; more grotesque. |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1474 (and (= dayname (calendar-day-of-week date)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1475 (let* ((m (extract-calendar-month date)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1476 (d (extract-calendar-day date)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1477 (y (extract-calendar-year date)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1478 (limit; last (n>0) or first (n<0) possible base date for entry |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1479 (calendar-nth-named-absday (- n) dayname m y d)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1480 (last-abs (if (> n 0) limit (+ limit 6))) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1481 (first-abs (if (> n 0) (- limit 6) limit)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1482 (last (calendar-gregorian-from-absolute last-abs)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1483 (first (calendar-gregorian-from-absolute first-abs)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1484 ; m1, d1 is first possible base date |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1485 (m1 (extract-calendar-month first)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1486 (d1 (extract-calendar-day first)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1487 (y1 (extract-calendar-year first)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1488 ; m2, d2 is last possible base date |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1489 (m2 (extract-calendar-month last)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1490 (d2 (extract-calendar-day last)) |
b3514551f08d
(diary-float): Rewritten to fix bug when base date
Richard M. Stallman <rms@gnu.org>
parents:
17626
diff
changeset
|
1491 (y2 (extract-calendar-year last))) |
23908
2a56bdf4cef7
(diary-float): Fix end-of-year error and typos in comments.
Karl Heuer <kwzh@gnu.org>
parents:
23247
diff
changeset
|
1492 (if (or (and (= m1 m2) ; only possible base dates in one month |
35500
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1493 (or (eq month t) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1494 (if (listp month) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1495 (memq m1 month) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1496 (= m1 month))) |
18590
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1497 (let ((d (or day (if (> n 0) |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1498 1 |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1499 (calendar-last-day-of-month m1 y1))))) |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1500 (and (<= d1 d) (<= d d2)))) |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1501 ;; only possible base dates straddle two months |
23998
6a6bb17fba97
(diary-float): Better fix of end-of-year error.
Richard M. Stallman <rms@gnu.org>
parents:
23908
diff
changeset
|
1502 (and (or (< y1 y2) |
6a6bb17fba97
(diary-float): Better fix of end-of-year error.
Richard M. Stallman <rms@gnu.org>
parents:
23908
diff
changeset
|
1503 (and (= y1 y2) (< m1 m2))) |
18590
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1504 (or |
23908
2a56bdf4cef7
(diary-float): Fix end-of-year error and typos in comments.
Karl Heuer <kwzh@gnu.org>
parents:
23247
diff
changeset
|
1505 ;; m1, d1 works as a base date |
18590
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1506 (and |
35500
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1507 (or (eq month t) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1508 (if (listp month) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1509 (memq m1 month) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1510 (= m1 month))) |
18590
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1511 (<= d1 (or day (if (> n 0) |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1512 1 |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1513 (calendar-last-day-of-month m1 y1))))) |
23908
2a56bdf4cef7
(diary-float): Fix end-of-year error and typos in comments.
Karl Heuer <kwzh@gnu.org>
parents:
23247
diff
changeset
|
1514 ;; m2, d2 works as a base date |
35500
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1515 (and (or (eq month t) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1516 (if (listp month) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1517 (memq m2 month) |
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1518 (= m2 month))) |
18590
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1519 (<= (or day (if (> n 0) |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1520 1 |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1521 (calendar-last-day-of-month m2 y2))) |
7d2a26d2371d
(diary-float): Fix errors in previous change.
Richard M. Stallman <rms@gnu.org>
parents:
17892
diff
changeset
|
1522 d2))))) |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1523 (cons mark entry))))) |
13053 | 1524 |
35500
38b437f4134e
(diary-float): Fix case of MONTH
Gerd Moellmann <gerd@gnu.org>
parents:
34036
diff
changeset
|
1525 |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1526 (defun diary-anniversary (month day &optional year mark) |
13053 | 1527 "Anniversary diary entry. |
1528 Entry applies if date is the anniversary of MONTH, DAY, YEAR if | |
1529 `european-calendar-style' is nil, and DAY, MONTH, YEAR if | |
1530 `european-calendar-style' is t. Diary entry can contain `%d' or `%d%s'; the | |
1531 %d will be replaced by the number of years since the MONTH DAY, YEAR and the | |
1532 %s will be replaced by the ordinal ending of that number (that is, `st', `nd', | |
1533 `rd' or `th', as appropriate. The anniversary of February 29 is considered | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1534 to be March 1 in non-leap years. |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1535 |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1536 An optional parameter MARK specifies a face or single-character string to |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1537 use when highlighting the day in the calendar." |
13053 | 1538 (let* ((d (if european-calendar-style |
1539 month | |
1540 day)) | |
1541 (m (if european-calendar-style | |
1542 day | |
1543 month)) | |
1544 (y (extract-calendar-year date)) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1545 (diff (if year (- y year) 100))) |
13053 | 1546 (if (and (= m 2) (= d 29) (not (calendar-leap-year-p y))) |
1547 (setq m 3 | |
1548 d 1)) | |
1549 (if (and (> diff 0) (calendar-date-equal (list m d y) date)) | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1550 (cons mark (format entry diff (diary-ordinal-suffix diff)))))) |
13053 | 1551 |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1552 (defun diary-cyclic (n month day year &optional mark) |
13053 | 1553 "Cycle diary entry--entry applies every N days starting at MONTH, DAY, YEAR. |
1554 If `european-calendar-style' is t, parameters are N, DAY, MONTH, YEAR. | |
1555 ENTRY can contain `%d' or `%d%s'; the %d will be replaced by the number of | |
32415
82747626b78b
(diary-cyclic): Doc fix from Ed Reingold.
Gerd Moellmann <gerd@gnu.org>
parents:
28615
diff
changeset
|
1556 repetitions since the MONTH DAY, YEAR and %s will be replaced by the |
82747626b78b
(diary-cyclic): Doc fix from Ed Reingold.
Gerd Moellmann <gerd@gnu.org>
parents:
28615
diff
changeset
|
1557 ordinal ending of that number (that is, `st', `nd', `rd' or `th', as |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1558 appropriate. |
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1559 |
46826
e020f18c490a
(diary-mail-entries): Use `compose-mail'
Sam Steingold <sds@gnu.org>
parents:
46620
diff
changeset
|
1560 An optional parameter MARK specifies a face or single-character string to |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1561 use when highlighting the day in the calendar." |
13053 | 1562 (let* ((d (if european-calendar-style |
1563 month | |
1564 day)) | |
1565 (m (if european-calendar-style | |
1566 day | |
1567 month)) | |
1568 (diff (- (calendar-absolute-from-gregorian date) | |
1569 (calendar-absolute-from-gregorian | |
1570 (list m d year)))) | |
1571 (cycle (/ diff n))) | |
1572 (if (and (>= diff 0) (zerop (% diff n))) | |
46620
f367f20901c0
(mark-sexp-diary-entries): Retrieve mark
Richard M. Stallman <rms@gnu.org>
parents:
44732
diff
changeset
|
1573 (cons mark (format entry cycle (diary-ordinal-suffix cycle)))))) |
13053 | 1574 |
1575 (defun diary-ordinal-suffix (n) | |
1576 "Ordinal suffix for N. (That is, `st', `nd', `rd', or `th', as appropriate.)" | |
1577 (if (or (memq (% n 100) '(11 12 13)) | |
1578 (< 3 (% n 10))) | |
1579 "th" | |
1580 (aref ["th" "st" "nd" "rd"] (% n 10)))) | |
1581 | |
1582 (defun diary-day-of-year () | |
1583 "Day of year and number of days remaining in the year of date diary entry." | |
1584 (calendar-day-of-year-string date)) | |
1585 | |
17626 | 1586 (defcustom diary-remind-message |
13053 | 1587 '("Reminder: Only " |
1588 (if (= 0 (% days 7)) | |
1589 (concat (int-to-string (/ days 7)) (if (= 7 days) " week" " weeks")) | |
1590 (concat (int-to-string days) (if (= 1 days) " day" " days"))) | |
1591 " until " | |
1592 diary-entry) | |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1593 "Pseudo-pattern giving form of reminder messages in the fancy diary |
13053 | 1594 display. |
39615
4287ce76bf9f
(diary-entry-compare): When times are identical, compare the entries
Sam Steingold <sds@gnu.org>
parents:
38422
diff
changeset
|
1595 |
13053 | 1596 Used by the function `diary-remind', a pseudo-pattern is a list of |
1597 expressions that can involve the keywords `days' (a number), `date' (a list of | |
17626 | 1598 month, day, year), and `diary-entry' (a string)." |
1599 :type 'sexp | |
1600 :group 'diary) | |
13053 | 1601 |
1602 (defun diary-remind (sexp days &optional marking) | |
1603 "Provide a reminder of a diary entry. | |
1604 SEXP is a diary-sexp. DAYS is either a single number or a list of numbers | |
1605 indicating the number(s) of days before the event that the warning(s) should | |
1606 occur on. If the current date is (one of) DAYS before the event indicated by | |
1607 SEXP, then a suitable message (as specified by `diary-remind-message' is | |
1608 returned. | |
1609 | |
24684
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1610 In addition to the reminders beforehand, the diary entry also appears on the |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1611 date itself. |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1612 |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1613 A `diary-nonmarking-symbol' at the beginning of the line of the diary-remind |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1614 entry specifies that the diary entry (not the reminder) is non-marking. |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1615 Marking of reminders is independent of whether the entry itself is a marking |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1616 or nonmarking; if optional parameter MARKING is non-nil then the reminders are |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1617 marked on the calendar." |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1618 (let ((diary-entry (eval sexp))) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1619 (cond |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1620 ;; Diary entry applies on date |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1621 ((and diary-entry |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1622 (or (not marking-diary-entries) marking-diary-entry)) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1623 diary-entry) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1624 ;; Diary entry may apply to `days' before date |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1625 ((and (integerp days) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1626 (not diary-entry); Diary entry does not apply to date |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1627 (or (not marking-diary-entries) marking)) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1628 (let ((date (calendar-gregorian-from-absolute |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1629 (+ (calendar-absolute-from-gregorian date) days)))) |
60298
6f85d024a41d
(diary-remind): Discard any mark portion from diary-entry. Reported
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1630 (when (setq diary-entry (eval sexp)) ; re-evaluate with adjusted date |
6f85d024a41d
(diary-remind): Discard any mark portion from diary-entry. Reported
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1631 ;; Discard any mark portion from diary-anniversary, etc. |
6f85d024a41d
(diary-remind): Discard any mark portion from diary-entry. Reported
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1632 (if (consp diary-entry) (setq diary-entry (cdr diary-entry))) |
6f85d024a41d
(diary-remind): Discard any mark portion from diary-entry. Reported
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1633 (mapconcat 'eval diary-remind-message "")))) |
24684
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1634 ;; Diary entry may apply to one of a list of days before date |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1635 ((and (listp days) days) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1636 (or (diary-remind sexp (car days) marking) |
cca41b0e7ae7
(diary-remind): Rewritten to behave sensibly for
Karl Heuer <kwzh@gnu.org>
parents:
24192
diff
changeset
|
1637 (diary-remind sexp (cdr days) marking)))))) |
13053 | 1638 |
65107
8e982d56281b
(diary-modify-entry-list-string-function): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64085
diff
changeset
|
1639 (defvar diary-modify-entry-list-string-function nil |
8e982d56281b
(diary-modify-entry-list-string-function): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64085
diff
changeset
|
1640 "Function applied to entry string before putting it into the entries list. |
65108
3c2360bf81c4
Documentation string of diary-modify-entry-list-string-function improved.
Carsten Dominik <dominik@science.uva.nl>
parents:
65107
diff
changeset
|
1641 Can be used by programs integrating a diary list into other buffers (e.g. |
3c2360bf81c4
Documentation string of diary-modify-entry-list-string-function improved.
Carsten Dominik <dominik@science.uva.nl>
parents:
65107
diff
changeset
|
1642 org.el and planner.el) to modify the string or add properties to it. |
3c2360bf81c4
Documentation string of diary-modify-entry-list-string-function improved.
Carsten Dominik <dominik@science.uva.nl>
parents:
65107
diff
changeset
|
1643 The function takes a string argument and must return a string.") |
65107
8e982d56281b
(diary-modify-entry-list-string-function): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64085
diff
changeset
|
1644 |
61384
986610dafc6c
(add-to-diary-list): MARKER argument made
Carsten Dominik <dominik@science.uva.nl>
parents:
60650
diff
changeset
|
1645 (defun add-to-diary-list (date string specifier &optional marker globcolor) |
49737
a8a5fd61aada
(diary-attrtype-convert): Convert an attribute value string to the desired type.
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1646 "Add the entry (DATE STRING SPECIFIER MARKER GLOBCOLOR) to `diary-entries-list'. |
13053 | 1647 Do nothing if DATE or STRING is nil." |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1648 (when (and date string) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1649 (if diary-file-name-prefix |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1650 (let ((prefix (funcall diary-file-name-prefix-function |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1651 (buffer-file-name)))) |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1652 (or (string= prefix "") |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1653 (setq string (format "[%s] %s" prefix string))))) |
65107
8e982d56281b
(diary-modify-entry-list-string-function): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64085
diff
changeset
|
1654 (and diary-modify-entry-list-string-function |
8e982d56281b
(diary-modify-entry-list-string-function): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64085
diff
changeset
|
1655 (setq string (funcall diary-modify-entry-list-string-function |
8e982d56281b
(diary-modify-entry-list-string-function): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64085
diff
changeset
|
1656 string))) |
50904
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1657 (setq diary-entries-list |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1658 (append diary-entries-list |
44fe653dccdb
(diary-pull-attrs): Make `ret-attr', `attr' local.
Glenn Morris <rgm@gnu.org>
parents:
50699
diff
changeset
|
1659 (list (list date string specifier marker globcolor)))))) |
13053 | 1660 |
60321
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1661 (defun diary-redraw-calendar () |
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1662 "If `calendar-buffer' is live and diary entries are marked, redraw it." |
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1663 (and mark-diary-entries-in-calendar |
60650
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
1664 (save-excursion |
5294e5833aef
(mark-diary-entries): Use new optional argument REDRAW rather than
Glenn Morris <rgm@gnu.org>
parents:
60567
diff
changeset
|
1665 (redraw-calendar))) |
60321
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1666 ;; Return value suitable for `write-contents-functions'. |
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1667 nil) |
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1668 |
13053 | 1669 (defun make-diary-entry (string &optional nonmarking file) |
1670 "Insert a diary entry STRING which may be NONMARKING in FILE. | |
60321
efcf9ada3122
(mark-diary-entries): Remove any old marks first.
Glenn Morris <rgm@gnu.org>
parents:
60298
diff
changeset
|
1671 If omitted, NONMARKING defaults to nil and FILE defaults to |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1672 `diary-file'." |
52319
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
1673 (let ((pop-up-frames (window-dedicated-p (selected-window)))) |
c701edc37ab5
(simple-diary-display, make-diary-entry): Allow the diary to pop up a
Glenn Morris <rgm@gnu.org>
parents:
52117
diff
changeset
|
1674 (find-file-other-window (substitute-in-file-name (or file diary-file)))) |
66869
cfc510b6c9e6
(diary-list-entries, diary-show-all-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66429
diff
changeset
|
1675 (when (eq major-mode default-major-mode) (diary-mode)) |
48312
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1676 (widen) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1677 (diary-unhide-everything) |
13053 | 1678 (goto-char (point-max)) |
48312
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1679 (when (let ((case-fold-search t)) |
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1680 (search-backward "Local Variables:" |
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1681 (max (- (point-max) 3000) (point-min)) |
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1682 t)) |
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1683 (beginning-of-line) |
67f6a633fe52
calendar/diary-lib.el (make-diary-entry): Allow for local variables at end of
Juanma Barranquero <lekktu@gmail.com>
parents:
47922
diff
changeset
|
1684 (insert "\n") |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1685 (forward-line -1)) |
13053 | 1686 (insert |
1687 (if (bolp) "" "\n") | |
1688 (if nonmarking diary-nonmarking-symbol "") | |
1689 string " ")) | |
1690 | |
1691 (defun insert-diary-entry (arg) | |
1692 "Insert a diary entry for the date indicated by point. | |
1693 Prefix arg will make the entry nonmarking." | |
1694 (interactive "P") | |
1695 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t t) | |
1696 arg)) | |
1697 | |
1698 (defun insert-weekly-diary-entry (arg) | |
1699 "Insert a weekly diary entry for the day of the week indicated by point. | |
1700 Prefix arg will make the entry nonmarking." | |
1701 (interactive "P") | |
1702 (make-diary-entry (calendar-day-name (calendar-cursor-to-date t)) | |
1703 arg)) | |
1704 | |
1705 (defun insert-monthly-diary-entry (arg) | |
1706 "Insert a monthly diary entry for the day of the month indicated by point. | |
1707 Prefix arg will make the entry nonmarking." | |
1708 (interactive "P") | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1709 (let ((calendar-date-display-form |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1710 (if european-calendar-style |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1711 '(day " * ") |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1712 '("* " day)))) |
13053 | 1713 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t) |
1714 arg))) | |
1715 | |
1716 (defun insert-yearly-diary-entry (arg) | |
1717 "Insert an annual diary entry for the day of the year indicated by point. | |
1718 Prefix arg will make the entry nonmarking." | |
1719 (interactive "P") | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1720 (let ((calendar-date-display-form |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1721 (if european-calendar-style |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1722 '(day " " monthname) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1723 '(monthname " " day)))) |
13053 | 1724 (make-diary-entry (calendar-date-string (calendar-cursor-to-date t) t) |
1725 arg))) | |
1726 | |
1727 (defun insert-anniversary-diary-entry (arg) | |
1728 "Insert an anniversary diary entry for the date given by point. | |
1729 Prefix arg will make the entry nonmarking." | |
1730 (interactive "P") | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1731 (let ((calendar-date-display-form |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1732 (if european-calendar-style |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1733 '(day " " month " " year) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1734 '(month " " day " " year)))) |
13053 | 1735 (make-diary-entry |
1736 (format "%s(diary-anniversary %s)" | |
1737 sexp-diary-entry-symbol | |
1738 (calendar-date-string (calendar-cursor-to-date t) nil t)) | |
1739 arg))) | |
1740 | |
1741 (defun insert-block-diary-entry (arg) | |
1742 "Insert a block diary entry for the days between the point and marked date. | |
1743 Prefix arg will make the entry nonmarking." | |
1744 (interactive "P") | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1745 (let ((calendar-date-display-form |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1746 (if european-calendar-style |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1747 '(day " " month " " year) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1748 '(month " " day " " year))) |
13053 | 1749 (cursor (calendar-cursor-to-date t)) |
1750 (mark (or (car calendar-mark-ring) | |
1751 (error "No mark set in this buffer"))) | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1752 start end) |
13053 | 1753 (if (< (calendar-absolute-from-gregorian mark) |
1754 (calendar-absolute-from-gregorian cursor)) | |
1755 (setq start mark | |
1756 end cursor) | |
1757 (setq start cursor | |
1758 end mark)) | |
1759 (make-diary-entry | |
1760 (format "%s(diary-block %s %s)" | |
1761 sexp-diary-entry-symbol | |
1762 (calendar-date-string start nil t) | |
1763 (calendar-date-string end nil t)) | |
1764 arg))) | |
1765 | |
1766 (defun insert-cyclic-diary-entry (arg) | |
1767 "Insert a cyclic diary entry starting at the date given by point. | |
1768 Prefix arg will make the entry nonmarking." | |
1769 (interactive "P") | |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1770 (let ((calendar-date-display-form |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1771 (if european-calendar-style |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1772 '(day " " month " " year) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1773 '(month " " day " " year)))) |
13053 | 1774 (make-diary-entry |
1775 (format "%s(diary-cyclic %d %s)" | |
1776 sexp-diary-entry-symbol | |
1777 (calendar-read "Repeat every how many days: " | |
28615
4c6883cb70ab
(fancy-diary-display, mark-diary-entries)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28575
diff
changeset
|
1778 (lambda (x) (> x 0))) |
13053 | 1779 (calendar-date-string (calendar-cursor-to-date t) nil t)) |
1780 arg))) | |
1781 | |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1782 (defvar diary-mode-map |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1783 (let ((map (make-sparse-keymap))) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1784 (define-key map "\C-c\C-s" 'diary-show-all-entries) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1785 (define-key map "\C-c\C-q" 'quit-window) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1786 map) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1787 "Keymap for `diary-mode'.") |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1788 |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1789 ;;;###autoload |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1790 (define-derived-mode diary-mode fundamental-mode "Diary" |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1791 "Major mode for editing the diary file." |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1792 (set (make-local-variable 'font-lock-defaults) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1793 '(diary-font-lock-keywords t)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1794 (add-to-invisibility-spec '(diary . nil)) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1795 (add-hook 'after-save-hook 'diary-redraw-calendar nil t) |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1796 (if diary-header-line-flag |
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1797 (setq header-line-format diary-header-line-format))) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1798 |
54757
8c93a61e3b54
(diary-mode, fancy-diary-display-mode): Derive from fundamental-mode
Glenn Morris <rgm@gnu.org>
parents:
54537
diff
changeset
|
1799 (define-derived-mode fancy-diary-display-mode fundamental-mode |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1800 "Diary" |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1801 "Major mode used while displaying diary entries using Fancy Display." |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1802 (set (make-local-variable 'font-lock-defaults) |
50699
fa4e7ecda348
(fancy-diary-display-mode): Bind "q" to `quit-window'
Sam Steingold <sds@gnu.org>
parents:
49737
diff
changeset
|
1803 '(fancy-diary-font-lock-keywords t)) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1804 (local-set-key "q" 'quit-window)) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1805 |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1806 |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1807 (defvar fancy-diary-font-lock-keywords |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1808 (list |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1809 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1810 (concat |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1811 (let ((dayname (diary-name-pattern calendar-day-name-array nil t)) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1812 (monthname (diary-name-pattern calendar-month-name-array nil t)) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1813 (day "[0-9]+") |
48421
9f9b3764df98
(fancy-diary-font-lock-keywords): Grok month numbers, too.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
48372
diff
changeset
|
1814 (month "[0-9]+") |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1815 (year "-?[0-9]+")) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1816 (mapconcat 'eval calendar-date-display-form "")) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1817 "\\(\\(: .*\\)\\|\\(\n +.*\\)\\)*\n=+$") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1818 'diary-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1819 '("^.*anniversary.*$" . font-lock-keyword-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1820 '("^.*birthday.*$" . font-lock-keyword-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1821 '("^.*Yahrzeit.*$" . font-lock-reference-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1822 '("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1823 '("^Day.*omer.*$" . font-lock-builtin-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1824 '("^Parashat.*$" . font-lock-comment-face) |
53548
65fe9b0d6ac6
(diary-entry-time): Also accept time in the form XX[.XX][am/pm/AM/PM].
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52412
diff
changeset
|
1825 '("^[ \t]*[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\)?" |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1826 . font-lock-variable-name-face)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1827 "Keywords to highlight in fancy diary display") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1828 |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1829 |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1830 (defun diary-font-lock-sexps (limit) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1831 "Recognize sexp diary entry for font-locking." |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1832 (if (re-search-forward |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1833 (concat "^" (regexp-quote diary-nonmarking-symbol) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1834 "?\\(" (regexp-quote sexp-diary-entry-symbol) "\\)") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1835 limit t) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1836 (condition-case nil |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1837 (save-restriction |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1838 (narrow-to-region (point-min) limit) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1839 (let ((start (point))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1840 (forward-sexp 1) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1841 (store-match-data (list start (point))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1842 t)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1843 (error t)))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1844 |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1845 (defun diary-font-lock-date-forms (month-array &optional symbol abbrev-array) |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1846 "Create font-lock patterns for `diary-date-forms' using MONTH-ARRAY. |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1847 If given, optional SYMBOL must be a prefix to entries. |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1848 If optional ABBREV-ARRAY is present, the abbreviations constructed |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1849 from this array by the function `calendar-abbrev-construct' are |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1850 matched (with or without a final `.'), in addition to the full month |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1851 names." |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1852 (let ((dayname (diary-name-pattern calendar-day-name-array |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1853 calendar-day-abbrev-array t)) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1854 (monthname (format "\\(%s\\|\\*\\)" |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1855 (diary-name-pattern month-array abbrev-array))) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1856 (month "\\([0-9]+\\|\\*\\)") |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1857 (day "\\([0-9]+\\|\\*\\)") |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1858 (year "-?\\([0-9]+\\|\\*\\)")) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1859 (mapcar (lambda (x) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1860 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1861 (concat "^" (regexp-quote diary-nonmarking-symbol) "?" |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1862 (if symbol (regexp-quote symbol) "") "\\(" |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1863 (mapconcat 'eval |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1864 ;; If backup, omit first item (backup) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1865 ;; and last item (not part of date) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1866 (if (equal (car x) 'backup) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1867 (nreverse (cdr (reverse (cdr x)))) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1868 x) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1869 "") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1870 ;; With backup, last item is not part of date |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1871 (if (equal (car x) 'backup) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1872 (concat "\\)" (eval (car (reverse x)))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1873 "\\)")) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1874 '(1 diary-face))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1875 diary-date-forms))) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1876 |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1877 (eval-when-compile (require 'cal-hebrew) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1878 (require 'cal-islam)) |
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1879 |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1880 (defconst diary-time-regexp |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1881 ;; Formats that should be accepted: |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1882 ;; 10:00 10.00 10h00 10h 10am 10:00am 10.00am |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1883 (concat "[0-9]?[0-9]\\([AaPp][mM]\\|\\(" |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1884 "[Hh]\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]" |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1885 "\\)\\([AaPp][Mm]\\)?\\)")) |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1886 |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1887 (defvar diary-font-lock-keywords |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1888 (append |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1889 (diary-font-lock-date-forms calendar-month-name-array |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1890 nil calendar-month-abbrev-array) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1891 (when (or (memq 'mark-hebrew-diary-entries |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1892 nongregorian-diary-marking-hook) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1893 (memq 'list-hebrew-diary-entries |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1894 nongregorian-diary-listing-hook)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1895 (require 'cal-hebrew) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1896 (diary-font-lock-date-forms |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1897 calendar-hebrew-month-name-array-leap-year |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1898 hebrew-diary-entry-symbol)) |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1899 (when (or (memq 'mark-islamic-diary-entries |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1900 nongregorian-diary-marking-hook) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1901 (memq 'list-islamic-diary-entries |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1902 nongregorian-diary-listing-hook)) |
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1903 (require 'cal-islam) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1904 (diary-font-lock-date-forms |
51640
6732b4ce8c04
(diary-check-diary-file): New function.
Glenn Morris <rgm@gnu.org>
parents:
50908
diff
changeset
|
1905 calendar-islamic-month-name-array |
52117
e8a77526768b
(list-diary-entries): Adapt for new behaviour of `calendar-day-name'
Glenn Morris <rgm@gnu.org>
parents:
51640
diff
changeset
|
1906 islamic-diary-entry-symbol)) |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1907 (list |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1908 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1909 (concat "^" (regexp-quote diary-include-string) ".*$") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1910 'font-lock-keyword-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1911 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1912 (concat "^" (regexp-quote diary-nonmarking-symbol) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1913 "?\\(" (regexp-quote sexp-diary-entry-symbol) "\\)") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1914 '(1 font-lock-reference-face)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1915 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1916 (concat "^" (regexp-quote diary-nonmarking-symbol)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1917 'font-lock-reference-face) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1918 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1919 (concat "^" (regexp-quote diary-nonmarking-symbol) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1920 "?\\(" (regexp-quote hebrew-diary-entry-symbol) "\\)") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1921 '(1 font-lock-reference-face)) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1922 (cons |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1923 (concat "^" (regexp-quote diary-nonmarking-symbol) |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1924 "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)") |
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1925 '(1 font-lock-reference-face)) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1926 '(diary-font-lock-sexps . font-lock-keyword-face) |
65875
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1927 (cons |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1928 (concat ;; "^[ \t]+" |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1929 diary-time-regexp "\\(-" diary-time-regexp "\\)?") |
8c8c651e39cc
Use overlays rather than selective-display.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65619
diff
changeset
|
1930 'font-lock-function-name-face))) |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
1931 "Forms to highlight in `diary-mode'.") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48421
diff
changeset
|
1932 |
48365
25f62a7a6efc
Patch of Alan Shutko <ats@acm.org> by way of rms.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48312
diff
changeset
|
1933 |
55249 | 1934 ;; Following code from Dave Love <fx@gnu.org>. |
1935 ;; Import Outlook-format appointments from mail messages in Gnus or | |
1936 ;; Rmail using command `diary-from-outlook'. This, or the specialized | |
1937 ;; functions `diary-from-outlook-gnus' and `diary-from-outlook-rmail', | |
1938 ;; could be run from hooks to notice appointments automatically (in | |
1939 ;; which case they will prompt about adding to the diary). The | |
1940 ;; message formats recognized are customizable through | |
1941 ;; `diary-outlook-formats'. | |
1942 | |
1943 (defcustom diary-outlook-formats | |
1944 '( | |
1945 ;; When: 11 October 2001 12:00-14:00 (GMT) Greenwich Mean Time : Dublin, ... | |
1946 ;; [Current UK format? The timezone is meaningless. Sometimes the | |
1947 ;; Where is missing.] | |
1948 ("When: \\([0-9]+ [[:alpha:]]+ [0-9]+\\) \ | |
1949 \\([^ ]+\\) [^\n]+ | |
1950 \[^\n]+ | |
1951 \\(?:Where: \\([^\n]+\\)\n+\\)? | |
1952 \\*~\\*~\\*~\\*~\\*~\\*~\\*~\\*~\\*~\\*" | |
1953 . "\\1\n \\2 %s, \\3") | |
1954 ;; When: Tuesday, April 30, 2002 03:00 PM-03:30 PM (GMT) Greenwich Mean ... | |
1955 ;; [Old UK format?] | |
1956 ("^When: [[:alpha:]]+, \\([[:alpha:]]+\\) \\([0-9][0-9]*\\), \\([0-9]\\{4\\}\\) \ | |
1957 \\([^ ]+\\) [^\n]+ | |
1958 \[^\n]+ | |
1959 \\(?:Where: \\([^\n]+\\)\\)?\n+" | |
1960 . "\\2 \\1 \\3\n \\4 %s, \\5") | |
1961 ( | |
1962 ;; German format, apparently. | |
1963 "^Zeit: [^ ]+, +\\([0-9]+\\)\. +\\([[:upper:]][[:lower:]][[:lower:]]\\)[^ ]* +\\([0-9]+\\) +\\([^ ]+\\).*$" | |
1964 . "\\1 \\2 \\3\n \\4 %s")) | |
1965 "Alist of regexps matching message text and replacement text. | |
1966 | |
1967 The regexp must match the start of the message text containing an | |
1968 appointment, but need not include a leading `^'. If it matches the | |
1969 current message, a diary entry is made from the corresponding | |
1970 template. If the template is a string, it should be suitable for | |
1971 passing to `replace-match', and so will have occurrences of `\\D' to | |
1972 substitute the match for the Dth subexpression. It must also contain | |
1973 a single `%s' which will be replaced with the text of the message's | |
1974 Subject field. Any other `%' characters must be doubled, so that the | |
1975 template can be passed to `format'. | |
1976 | |
1977 If the template is actually a function, it is called with the message | |
1978 body text as argument, and may use `match-string' etc. to make a | |
1979 template following the rules above." | |
1980 :type '(alist :key-type (regexp :tag "Regexp matching time/place") | |
1981 :value-type (choice | |
1982 (string :tag "Template for entry") | |
1983 (function :tag "Unary function providing template"))) | |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59063
diff
changeset
|
1984 :version "22.1" |
55249 | 1985 :group 'diary) |
1986 | |
1987 | |
1988 ;; Dynamically bound. | |
1989 (defvar body) | |
1990 (defvar subject) | |
1991 | |
1992 (defun diary-from-outlook-internal (&optional test-only) | |
1993 "Snarf a diary entry from a message assumed to be from MS Outlook. | |
1994 Assumes `body' is bound to a string comprising the body of the message and | |
1995 `subject' is bound to a string comprising its subject. | |
1996 Arg TEST-ONLY non-nil means return non-nil if and only if the | |
1997 message contains an appointment, don't make a diary entry." | |
1998 (catch 'finished | |
1999 (let (format-string) | |
2000 (dotimes (i (length diary-outlook-formats)) | |
2001 (when (eq 0 (string-match (car (nth i diary-outlook-formats)) | |
2002 body)) | |
2003 (unless test-only | |
2004 (setq format-string (cdr (nth i diary-outlook-formats))) | |
2005 (save-excursion | |
2006 (save-window-excursion | |
2007 ;; Fixme: References to optional fields in the format | |
2008 ;; are treated literally, not replaced by the empty | |
2009 ;; string. I think this is an Emacs bug. | |
2010 (make-diary-entry | |
2011 (format (replace-match (if (functionp format-string) | |
2012 (funcall format-string body) | |
2013 format-string) | |
2014 t nil (match-string 0 body)) | |
2015 subject)) | |
2016 (save-buffer)))) | |
2017 (throw 'finished t)))) | |
2018 nil)) | |
2019 | |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2020 (defun diary-from-outlook (&optional noconfirm) |
55249 | 2021 "Maybe snarf diary entry from current Outlook-generated message. |
58099
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2022 Currently knows about Gnus and Rmail modes. Unless the optional |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2023 argument NOCONFIRM is non-nil (which is the case when this |
58099
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2024 function is called interactively), then if an entry is found the |
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2025 user is asked to confirm its addition." |
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2026 (interactive "p") |
55249 | 2027 (let ((func (cond |
2028 ((eq major-mode 'rmail-mode) | |
2029 #'diary-from-outlook-rmail) | |
2030 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) | |
2031 #'diary-from-outlook-gnus) | |
2032 (t (error "Don't know how to snarf in `%s'" major-mode))))) | |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2033 (funcall func noconfirm))) |
55249 | 2034 |
2035 | |
2036 (defvar gnus-article-mime-handles) | |
2037 (defvar gnus-article-buffer) | |
2038 | |
2039 (autoload 'gnus-fetch-field "gnus-util") | |
2040 (autoload 'gnus-narrow-to-body "gnus") | |
2041 (autoload 'mm-get-part "mm-decode") | |
2042 | |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2043 (defun diary-from-outlook-gnus (&optional noconfirm) |
55249 | 2044 "Maybe snarf diary entry from Outlook-generated message in Gnus. |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2045 Unless the optional argument NOCONFIRM is non-nil (which is the case when |
58099
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2046 this function is called interactively), then if an entry is found the |
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2047 user is asked to confirm its addition. |
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2048 Add this function to `gnus-article-prepare-hook' to notice appointments |
55249 | 2049 automatically." |
58099
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2050 (interactive "p") |
55249 | 2051 (with-current-buffer gnus-article-buffer |
2052 (let ((subject (gnus-fetch-field "subject")) | |
2053 (body (if gnus-article-mime-handles | |
2054 ;; We're multipart. Don't get confused by part | |
2055 ;; buttons &c. Assume info is in first part. | |
2056 (mm-get-part (nth 1 gnus-article-mime-handles)) | |
2057 (save-restriction | |
2058 (gnus-narrow-to-body) | |
2059 (buffer-string))))) | |
2060 (when (diary-from-outlook-internal t) | |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2061 (when (or noconfirm (y-or-n-p "Snarf diary entry? ")) |
55249 | 2062 (diary-from-outlook-internal) |
2063 (message "Diary entry added")))))) | |
2064 | |
2065 (custom-add-option 'gnus-article-prepare-hook 'diary-from-outlook-gnus) | |
2066 | |
2067 | |
2068 (defvar rmail-buffer) | |
2069 | |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2070 (defun diary-from-outlook-rmail (&optional noconfirm) |
58099
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2071 "Maybe snarf diary entry from Outlook-generated message in Rmail. |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2072 Unless the optional argument NOCONFIRM is non-nil (which is the case when |
58099
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2073 this function is called interactively), then if an entry is found the |
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2074 user is asked to confirm its addition." |
0ff94b7bdea3
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
57255
diff
changeset
|
2075 (interactive "p") |
55249 | 2076 (with-current-buffer rmail-buffer |
2077 (let ((subject (mail-fetch-field "subject")) | |
2078 (body (buffer-substring (save-excursion | |
2079 (rfc822-goto-eoh) | |
2080 (point)) | |
2081 (point-max)))) | |
2082 (when (diary-from-outlook-internal t) | |
58101
e47a5c4e43ff
(diary-from-outlook, diary-from-outlook-gnus)
Glenn Morris <rgm@gnu.org>
parents:
58099
diff
changeset
|
2083 (when (or noconfirm (y-or-n-p "Snarf diary entry? ")) |
55249 | 2084 (diary-from-outlook-internal) |
2085 (message "Diary entry added")))))) | |
2086 | |
2087 | |
13650 | 2088 (provide 'diary-lib) |
13053 | 2089 |
65476
11058ae1650f
Use with-current-buffer, match-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
65108
diff
changeset
|
2090 ;; arch-tag: 22dd506e-2e33-410d-9ae1-095a0c1b2010 |
13650 | 2091 ;;; diary-lib.el ends here |