Mercurial > emacs
comparison lisp/calendar/calendar.el @ 92594:674c88622bd9
Move many autoloads to separate file, cal-loaddefs.el.
Move defcustoms to start and re-order.
(calendar-month-name-array, calendar-starred-day): No need to declare
for compiler.
(cal-loaddefs): Require it.
(appt, chinese-calendar, calendar-tex): Move custom groups to the
appropriate file.
(diary-entry-marker, calendar-today-marker, calendar-holiday-marker):
Reverse logic.
(diary-face, diary-file-name-prefix-function, diary-include-string)
(diary-glob-file-regexp-prefix, diary-face-attrs)
(diary-file-name-prefix, sexp-diary-entry-symbol)
(print-diary-entries-hook, list-diary-entries-hook)
(nongregorian-diary-listing-hook, mark-diary-entries-hook)
(nongregorian-diary-marking-hook, diary-list-include-blanks):
Move to diary-lib.
(all-christian-calendar-holidays, all-islamic-calendar-holidays)
(all-bahai-calendar-holidays): Doc fix.
(calendar-mark-ring): Add doc-string.
(calendar-starred-day): Defvar it.
(calendar-mode): Make calendar-starred-day local.
(calendar-star-date): No need to make calendar-starred-day local.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 08 Mar 2008 03:47:03 +0000 |
parents | a9c1d203dd4a |
children | 020d7b75c13a |
comparison
equal
deleted
inserted
replaced
92593:d5d618fbbbab | 92594:674c88622bd9 |
---|---|
93 | 93 |
94 ;;; Code: | 94 ;;; Code: |
95 | 95 |
96 (defvar displayed-month) | 96 (defvar displayed-month) |
97 (defvar displayed-year) | 97 (defvar displayed-year) |
98 (defvar calendar-month-name-array) | 98 |
99 (defvar calendar-starred-day) | 99 (require 'cal-loaddefs) |
100 (require 'cal-menu) | |
101 | |
100 | 102 |
101 (defgroup calendar nil | 103 (defgroup calendar nil |
102 "Calendar and time management support." | 104 "Calendar and time management support." |
103 :group 'applications) | 105 :group 'applications) |
104 | 106 |
107 (defgroup calendar-hooks nil | |
108 "Calendar hooks." | |
109 :prefix "calendar-" | |
110 :group 'calendar) | |
111 | |
105 (defgroup diary nil | 112 (defgroup diary nil |
106 "Emacs diary." | 113 "Emacs diary." |
107 :group 'calendar) | |
108 | |
109 (defgroup appt nil | |
110 "Appointment notification." | |
111 :group 'calendar) | 114 :group 'calendar) |
112 | 115 |
113 (defgroup holidays nil | 116 (defgroup holidays nil |
114 "Holidays support in calendar." | 117 "Holidays support in calendar." |
115 :group 'calendar | 118 :group 'calendar |
116 :prefix "calendar-" | 119 :prefix "calendar-" |
117 :group 'local) | 120 :group 'local) |
118 | 121 |
119 (defgroup chinese-calendar nil | |
120 "Chinese calendar support." | |
121 :group 'calendar) | |
122 | |
123 (defgroup calendar-tex nil | |
124 "Options for printing calendar with LaTeX." | |
125 :prefix "cal-tex-" | |
126 :group 'calendar) | |
127 | |
128 (defgroup calendar-hooks nil | |
129 "Calendar hooks." | |
130 :prefix "calendar-" | |
131 :group 'calendar) | |
132 | |
133 | |
134 (defconst calendar-buffer "*Calendar*" | |
135 "Name of the buffer used for the calendar.") | |
136 | 122 |
137 (defcustom calendar-offset 0 | 123 (defcustom calendar-offset 0 |
138 "The offset of the principal month from the center of the calendar window. | 124 "The offset of the principal month from the center of the calendar window. |
139 0 means the principal month is in the center (default), -1 means on the left, | 125 0 means the principal month is in the center (default), -1 means on the left, |
140 +1 means on the right. Larger (or smaller) values push the principal month off | 126 +1 means on the right. Larger (or smaller) values push the principal month off |
141 the screen." | 127 the screen." |
142 :type 'integer | 128 :type 'integer |
129 :group 'calendar) | |
130 | |
131 (defcustom calendar-setup nil | |
132 "The frame setup of the calendar. | |
133 The choices are: `one-frame' (calendar and diary together in one separate, | |
134 dedicated frame); `two-frames' (calendar and diary in separate, dedicated | |
135 frames); `calendar-only' (calendar in a separate, dedicated frame); with | |
136 any other value the current frame is used. Using any of the first | |
137 three options overrides the value of `view-diary-entries-initially'." | |
138 :type '(choice | |
139 (const :tag "calendar and diary in separate frame" one-frame) | |
140 (const :tag "calendar and diary each in own frame" two-frames) | |
141 (const :tag "calendar in separate frame" calendar-only) | |
142 (const :tag "use current frame" nil)) | |
143 :group 'calendar) | |
144 | |
145 (defcustom calendar-minimum-window-height 8 | |
146 "Minimum height `generate-calendar-window' should use for calendar window." | |
147 :type 'integer | |
148 :version "22.1" | |
149 :group 'calendar) | |
150 | |
151 (defcustom calendar-week-start-day 0 | |
152 "The day of the week on which a week in the calendar begins. | |
153 0 means Sunday (default), 1 means Monday, and so on. | |
154 | |
155 If you change this variable directly (without using customize) | |
156 after starting `calendar', you should call `redraw-calendar' to | |
157 update the calendar display to reflect the change, otherwise | |
158 movement commands will not work correctly." | |
159 :type 'integer | |
160 ;; Change the initialize so that if you reload calendar.el, it will not | |
161 ;; cause a redraw (which may fail, e.g. with "invalid byte-code in | |
162 ;; calendar.elc" because of the "byte-compile-dynamic"). | |
163 :initialize 'custom-initialize-default | |
164 :set (lambda (sym val) | |
165 (set sym val) | |
166 (redraw-calendar)) | |
143 :group 'calendar) | 167 :group 'calendar) |
144 | 168 |
145 (defcustom view-diary-entries-initially nil | 169 (defcustom view-diary-entries-initially nil |
146 "Non-nil means display current date's diary entries on entry to calendar. | 170 "Non-nil means display current date's diary entries on entry to calendar. |
147 The diary is displayed in another window when the calendar is first displayed, | 171 The diary is displayed in another window when the calendar is first displayed, |
161 "Determine how the calendar mode removes a frame no longer needed. | 185 "Determine how the calendar mode removes a frame no longer needed. |
162 If nil, make an icon of the frame. If non-nil, delete the frame." | 186 If nil, make an icon of the frame. If non-nil, delete the frame." |
163 :type 'boolean | 187 :type 'boolean |
164 :group 'view) | 188 :group 'view) |
165 | 189 |
166 (defvar diary-face 'diary | 190 (defface calendar-today |
167 "Face name to use for diary entries.") | 191 '((t (:underline t))) |
192 "Face for indicating today's date." | |
193 :group 'diary) | |
194 ;; Backward-compatibility alias. FIXME make obsolete. | |
195 (put 'calendar-today-face 'face-alias 'calendar-today) | |
196 | |
168 (defface diary | 197 (defface diary |
169 '((((min-colors 88) (class color) (background light)) | 198 '((((min-colors 88) (class color) (background light)) |
170 :foreground "red1") | 199 :foreground "red1") |
171 (((class color) (background light)) | 200 (((class color) (background light)) |
172 :foreground "red") | 201 :foreground "red") |
176 :foreground "yellow") | 205 :foreground "yellow") |
177 (t | 206 (t |
178 :weight bold)) | 207 :weight bold)) |
179 "Face for highlighting diary entries." | 208 "Face for highlighting diary entries." |
180 :group 'diary) | 209 :group 'diary) |
181 ;; backward-compatibility alias | 210 ;; Backward-compatibility alias. FIXME make obsolete. |
182 (put 'diary-face 'face-alias 'diary) | 211 (put 'diary-face 'face-alias 'diary) |
183 | |
184 (defface calendar-today | |
185 '((t (:underline t))) | |
186 "Face for indicating today's date." | |
187 :group 'diary) | |
188 ;; backward-compatibility alias | |
189 (put 'calendar-today-face 'face-alias 'calendar-today) | |
190 | 212 |
191 (defface holiday | 213 (defface holiday |
192 '((((class color) (background light)) | 214 '((((class color) (background light)) |
193 :background "pink") | 215 :background "pink") |
194 (((class color) (background dark)) | 216 (((class color) (background dark)) |
195 :background "chocolate4") | 217 :background "chocolate4") |
196 (t | 218 (t |
197 :inverse-video t)) | 219 :inverse-video t)) |
198 "Face for indicating dates that have holidays." | 220 "Face for indicating dates that have holidays." |
199 :group 'diary) | 221 :group 'diary) |
200 ;; backward-compatibility alias | 222 ;; Backward-compatibility alias. FIXME make obsolete. |
201 (put 'holiday-face 'face-alias 'holiday) | 223 (put 'holiday-face 'face-alias 'holiday) |
202 | 224 |
203 (defcustom diary-entry-marker | 225 (defcustom diary-entry-marker (if (display-color-p) 'diary "+") |
204 (if (not (display-color-p)) | |
205 "+" | |
206 'diary) | |
207 "How to mark dates that have diary entries. | 226 "How to mark dates that have diary entries. |
208 The value can be either a single-character string or a face." | 227 The value can be either a single-character string or a face." |
209 :type '(choice string face) | 228 :type '(choice string face) |
210 :group 'diary) | 229 :group 'diary) |
211 | 230 |
212 (defcustom calendar-today-marker | 231 (defcustom calendar-today-marker (if (display-color-p) 'calendar-today "=") |
213 (if (not (display-color-p)) | |
214 "=" | |
215 'calendar-today) | |
216 "How to mark today's date in the calendar. | 232 "How to mark today's date in the calendar. |
217 The value can be either a single-character string or a face. | 233 The value can be either a single-character string or a face. |
218 Marking today's date is done only if you set up `today-visible-calendar-hook' | 234 Marking today's date is done only if you set up `today-visible-calendar-hook' |
219 to request that." | 235 to request that." |
220 :type '(choice string face) | 236 :type '(choice string face) |
221 :group 'calendar) | 237 :group 'calendar) |
222 | 238 |
223 (defcustom calendar-holiday-marker | 239 (defcustom calendar-holiday-marker (if (display-color-p) 'holiday "*") |
224 (if (not (display-color-p)) | |
225 "*" | |
226 'holiday) | |
227 "How to mark notable dates in the calendar. | 240 "How to mark notable dates in the calendar. |
228 The value can be either a single-character string or a face." | 241 The value can be either a single-character string or a face." |
229 :type '(choice string face) | 242 :type '(choice string face) |
230 :group 'calendar) | 243 :group 'calendar) |
231 | 244 |
237 :group 'holidays) | 250 :group 'holidays) |
238 | 251 |
239 (defcustom mark-holidays-in-calendar nil | 252 (defcustom mark-holidays-in-calendar nil |
240 "Non-nil means mark dates of holidays in the calendar window. | 253 "Non-nil means mark dates of holidays in the calendar window. |
241 The marking symbol is specified by the variable `calendar-holiday-marker'." | 254 The marking symbol is specified by the variable `calendar-holiday-marker'." |
242 :type 'boolean | |
243 :group 'holidays) | |
244 | |
245 (defcustom all-hebrew-calendar-holidays nil | |
246 "If nil, show only major holidays from the Hebrew calendar. | |
247 This means only those Jewish holidays that appear on secular calendars. | |
248 | |
249 If t, show all the holidays that would appear in a complete Hebrew calendar." | |
250 :type 'boolean | |
251 :group 'holidays) | |
252 | |
253 (defcustom all-christian-calendar-holidays nil | |
254 "If nil, show only major holidays from the Christian calendar. | |
255 This means only those Christian holidays that appear on secular calendars. | |
256 | |
257 If t, show all the holidays that would appear in a complete Christian | |
258 calendar." | |
259 :type 'boolean | |
260 :group 'holidays) | |
261 | |
262 (defcustom all-islamic-calendar-holidays nil | |
263 "If nil, show only major holidays from the Islamic calendar. | |
264 This means only those Islamic holidays that appear on secular calendars. | |
265 | |
266 If t, show all the holidays that would appear in a complete Islamic | |
267 calendar." | |
268 :type 'boolean | |
269 :group 'holidays) | |
270 | |
271 (defcustom diary-file-name-prefix-function (function (lambda (str) str)) | |
272 "The function that will take a diary file name and return the desired prefix." | |
273 :type 'function | |
274 :group 'diary) | |
275 | |
276 (defcustom all-bahai-calendar-holidays nil | |
277 "If nil, show only major holidays from the Baha'i calendar. | |
278 These are the days on which work and school must be suspended. | |
279 | |
280 If t, show all the holidays that would appear in a complete Baha'i | |
281 calendar." | |
282 :type 'boolean | 255 :type 'boolean |
283 :group 'holidays) | 256 :group 'holidays) |
284 | 257 |
285 (defcustom calendar-mode-hook nil | 258 (defcustom calendar-mode-hook nil |
286 "Hook run when entering `calendar-mode'." | 259 "Hook run when entering `calendar-mode'." |
467 :type 'string | 440 :type 'string |
468 :group 'diary) | 441 :group 'diary) |
469 | 442 |
470 (defcustom bahai-diary-entry-symbol "B" | 443 (defcustom bahai-diary-entry-symbol "B" |
471 "Symbol indicating a diary entry according to the Baha'i calendar." | 444 "Symbol indicating a diary entry according to the Baha'i calendar." |
472 :type 'string | |
473 :group 'diary) | |
474 | |
475 (defcustom diary-include-string "#include" | |
476 "The string indicating inclusion of another file of diary entries. | |
477 See the documentation for the function `include-other-diary-files'." | |
478 :type 'string | |
479 :group 'diary) | |
480 | |
481 (defcustom diary-glob-file-regexp-prefix "^\\#" | |
482 "Regular expression prepended to attribute-regexps for file-wide specifiers." | |
483 :type 'regexp | |
484 :group 'diary) | |
485 | |
486 (defcustom diary-face-attrs | |
487 '((" *\\[foreground:\\([-a-z]+\\)\\]$" 1 :foreground string) | |
488 (" *\\[background:\\([-a-z]+\\)\\]$" 1 :background string) | |
489 (" *\\[width:\\([-a-z]+\\)\\]$" 1 :width symbol) | |
490 (" *\\[height:\\([-0-9a-z]+\\)\\]$" 1 :height int) | |
491 (" *\\[weight:\\([-a-z]+\\)\\]$" 1 :weight symbol) | |
492 (" *\\[slant:\\([-a-z]+\\)\\]$" 1 :slant symbol) | |
493 (" *\\[underline:\\([-a-z]+\\)\\]$" 1 :underline stringtnil) | |
494 (" *\\[overline:\\([-a-z]+\\)\\]$" 1 :overline stringtnil) | |
495 (" *\\[strike-through:\\([-a-z]+\\)\\]$" 1 :strike-through stringtnil) | |
496 (" *\\[inverse-video:\\([-a-z]+\\)\\]$" 1 :inverse-video tnil) | |
497 (" *\\[face:\\([-0-9a-z]+\\)\\]$" 1 :face string) | |
498 (" *\\[font:\\([-a-z0-9]+\\)\\]$" 1 :font string) | |
499 ;; Unsupported. | |
500 ;;; (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box) | |
501 ;;; (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple) | |
502 ) | |
503 "A list of (regexp regnum attr attrtype) lists where the | |
504 regexp says how to find the tag, the regnum says which | |
505 parenthetical sub-regexp this regexp looks for, and the attr says | |
506 which attribute of the face (or that this _is_ a face) is being | |
507 modified." | |
508 :type 'sexp | |
509 :group 'diary) | |
510 | |
511 (defcustom diary-file-name-prefix nil | |
512 "If non-nil each diary entry is prefixed with the name of the file where it is defined." | |
513 :type 'boolean | |
514 :group 'diary) | |
515 | |
516 (defcustom sexp-diary-entry-symbol "%%" | |
517 "The string used to indicate a sexp diary entry in `diary-file'. | |
518 See the documentation for the function `list-sexp-diary-entries'." | |
519 :type 'string | 445 :type 'string |
520 :group 'diary) | 446 :group 'diary) |
521 | 447 |
522 (defcustom abbreviated-calendar-year t | 448 (defcustom abbreviated-calendar-year t |
523 "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. | 449 "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD. |
703 (setq european-calendar-style nil) | 629 (setq european-calendar-style nil) |
704 (setq calendar-date-display-form american-calendar-display-form) | 630 (setq calendar-date-display-form american-calendar-display-form) |
705 (setq diary-date-forms american-date-diary-pattern) | 631 (setq diary-date-forms american-date-diary-pattern) |
706 (update-calendar-mode-line)) | 632 (update-calendar-mode-line)) |
707 | 633 |
708 (defcustom print-diary-entries-hook 'lpr-buffer | 634 ;; FIXME move to diary-lib and adjust appt. |
709 "List of functions called after a temporary diary buffer is prepared. | |
710 The buffer shows only the diary entries currently visible in the diary | |
711 buffer. The default just does the printing. Other uses might include, for | |
712 example, rearranging the lines into order by day and time, saving the buffer | |
713 instead of deleting it, or changing the function used to do the printing." | |
714 :type 'hook | |
715 :group 'diary) | |
716 | |
717 (defcustom list-diary-entries-hook nil | |
718 "List of functions called after diary file is culled for relevant entries. | |
719 It is to be used for diary entries that are not found in the diary file. | |
720 | |
721 A function `include-other-diary-files' is provided for use as the value of | |
722 this hook. This function enables you to use shared diary files together | |
723 with your own. The files included are specified in the diary file by lines | |
724 of the form | |
725 | |
726 #include \"filename\" | |
727 | |
728 This is recursive; that is, #include directives in files thus included are | |
729 obeyed. You can change the \"#include\" to some other string by changing | |
730 the variable `diary-include-string'. When you use `include-other-diary-files' | |
731 as part of the list-diary-entries-hook, you will probably also want to use the | |
732 function `mark-included-diary-files' as part of `mark-diary-entries-hook'. | |
733 | |
734 For example, you could use | |
735 | |
736 (setq list-diary-entries-hook | |
737 '(include-other-diary-files sort-diary-entries)) | |
738 (setq diary-display-hook 'fancy-diary-display) | |
739 | |
740 in your `.emacs' file to cause the fancy diary buffer to be displayed with | |
741 diary entries from various included files, each day's entries sorted into | |
742 lexicographic order." | |
743 :type 'hook | |
744 :options '(include-other-diary-files sort-diary-entries) | |
745 :group 'diary) | |
746 | |
747 (defcustom diary-hook nil | 635 (defcustom diary-hook nil |
748 "List of functions called after the display of the diary. | 636 "List of functions called after the display of the diary. |
749 Can be used for appointment notification." | 637 Can be used for appointment notification." |
750 :type 'hook | 638 :type 'hook |
751 :group 'diary) | 639 :group 'diary) |
777 :options '(fancy-diary-display) | 665 :options '(fancy-diary-display) |
778 :initialize 'custom-initialize-default | 666 :initialize 'custom-initialize-default |
779 :set 'diary-set-maybe-redraw | 667 :set 'diary-set-maybe-redraw |
780 :group 'diary) | 668 :group 'diary) |
781 | 669 |
782 (defcustom nongregorian-diary-listing-hook nil | |
783 "List of functions called for listing diary file and included files. | |
784 As the files are processed for diary entries, these functions are used | |
785 to cull relevant entries. You can use either or both of | |
786 `list-hebrew-diary-entries', `list-islamic-diary-entries' and | |
787 `diary-bahai-list-entries'. The documentation for these functions | |
788 describes the style of such diary entries." | |
789 :type 'hook | |
790 :options '(list-hebrew-diary-entries | |
791 list-islamic-diary-entries | |
792 diary-bahai-list-entries) | |
793 :group 'diary) | |
794 | |
795 (defcustom mark-diary-entries-hook nil | |
796 "List of functions called after marking diary entries in the calendar. | |
797 | |
798 A function `mark-included-diary-files' is also provided for use as the | |
799 `mark-diary-entries-hook'; it enables you to use shared diary files together | |
800 with your own. The files included are specified in the diary file by lines | |
801 of the form | |
802 #include \"filename\" | |
803 This is recursive; that is, #include directives in files thus included are | |
804 obeyed. You can change the \"#include\" to some other string by changing the | |
805 variable `diary-include-string'. When you use `mark-included-diary-files' as | |
806 part of the mark-diary-entries-hook, you will probably also want to use the | |
807 function `include-other-diary-files' as part of `list-diary-entries-hook'." | |
808 :type 'hook | |
809 :options '(mark-included-diary-files) | |
810 :group 'diary) | |
811 | |
812 (defcustom nongregorian-diary-marking-hook nil | |
813 "List of functions called for marking diary file and included files. | |
814 As the files are processed for diary entries, these functions are used | |
815 to cull relevant entries. You can use either or both of | |
816 `mark-hebrew-diary-entries', `mark-islamic-diary-entries' and | |
817 `mark-bahai-diary-entries'. The documentation for these functions | |
818 describes the style of such diary entries." | |
819 :type 'hook | |
820 :options '(mark-hebrew-diary-entries | |
821 mark-islamic-diary-entries | |
822 diary-bahai-mark-entries) | |
823 :group 'diary) | |
824 | |
825 (defcustom diary-list-include-blanks nil | |
826 "If nil, do not include days with no diary entry in the list of diary entries. | |
827 Such days will then not be shown in the fancy diary buffer, even if they | |
828 are holidays." | |
829 :type 'boolean | |
830 :group 'diary) | |
831 | |
832 (defcustom holidays-in-diary-buffer t | 670 (defcustom holidays-in-diary-buffer t |
833 "Non-nil means include holidays in the diary display. | 671 "Non-nil means include holidays in the diary display. |
834 The holidays appear in the mode line of the diary buffer, or in the | 672 The holidays appear in the mode line of the diary buffer, or in the |
835 fancy diary buffer next to the date. This slows down the diary functions | 673 fancy diary buffer next to the date. This slows down the diary functions |
836 somewhat; setting it to nil makes the diary display faster." | 674 somewhat; setting it to nil makes the diary display faster." |
837 :type 'boolean | 675 :type 'boolean |
838 :group 'holidays) | 676 :group 'holidays) |
839 | 677 |
840 (defvar calendar-mark-ring nil) | 678 (defcustom calendar-debug-sexp nil |
841 | 679 "Turn debugging on when evaluating a sexp in the diary or holiday list." |
842 ;;;###autoload | 680 :type 'boolean |
843 (put 'general-holidays 'risky-local-variable t) | 681 :group 'calendar) |
682 | |
844 (defcustom general-holidays | 683 (defcustom general-holidays |
845 '((holiday-fixed 1 1 "New Year's Day") | 684 '((holiday-fixed 1 1 "New Year's Day") |
846 (holiday-float 1 1 3 "Martin Luther King Day") | 685 (holiday-float 1 1 3 "Martin Luther King Day") |
847 (holiday-fixed 2 2 "Groundhog Day") | 686 (holiday-fixed 2 2 "Groundhog Day") |
848 (holiday-fixed 2 14 "Valentine's Day") | 687 (holiday-fixed 2 14 "Valentine's Day") |
861 (holiday-float 11 4 4 "Thanksgiving")) | 700 (holiday-float 11 4 4 "Thanksgiving")) |
862 "General holidays. Default value is for the United States. | 701 "General holidays. Default value is for the United States. |
863 See the documentation for `calendar-holidays' for details." | 702 See the documentation for `calendar-holidays' for details." |
864 :type 'sexp | 703 :type 'sexp |
865 :group 'holidays) | 704 :group 'holidays) |
866 | |
867 ;;;###autoload | 705 ;;;###autoload |
868 (put 'oriental-holidays 'risky-local-variable t) | 706 (put 'general-holidays 'risky-local-variable t) |
707 | |
869 (defcustom oriental-holidays | 708 (defcustom oriental-holidays |
870 '((if (fboundp 'atan) | 709 '((if (fboundp 'atan) |
871 (holiday-chinese-new-year))) | 710 (holiday-chinese-new-year))) |
872 "Oriental holidays. | 711 "Oriental holidays. |
873 See the documentation for `calendar-holidays' for details." | 712 See the documentation for `calendar-holidays' for details." |
874 :type 'sexp | 713 :type 'sexp |
875 :group 'holidays) | 714 :group 'holidays) |
876 | |
877 ;;;###autoload | 715 ;;;###autoload |
878 (put 'local-holidays 'risky-local-variable t) | 716 (put 'oriental-holidays 'risky-local-variable t) |
717 | |
879 (defcustom local-holidays nil | 718 (defcustom local-holidays nil |
880 "Local holidays. | 719 "Local holidays. |
881 See the documentation for `calendar-holidays' for details." | 720 See the documentation for `calendar-holidays' for details." |
882 :type 'sexp | 721 :type 'sexp |
883 :group 'holidays) | 722 :group 'holidays) |
884 | |
885 ;;;###autoload | 723 ;;;###autoload |
886 (put 'other-holidays 'risky-local-variable t) | 724 (put 'local-holidays 'risky-local-variable t) |
725 | |
887 (defcustom other-holidays nil | 726 (defcustom other-holidays nil |
888 "User defined holidays. | 727 "User defined holidays. |
889 See the documentation for `calendar-holidays' for details." | 728 See the documentation for `calendar-holidays' for details." |
890 :type 'sexp | 729 :type 'sexp |
891 :group 'holidays) | 730 :group 'holidays) |
892 | |
893 ;;;###autoload | 731 ;;;###autoload |
894 (put 'hebrew-holidays-1 'risky-local-variable t) | 732 (put 'other-holidays 'risky-local-variable t) |
733 | |
734 (defcustom all-hebrew-calendar-holidays nil | |
735 "If nil, show only major holidays from the Hebrew calendar. | |
736 This means only those Jewish holidays that appear on secular calendars. | |
737 Otherwise, show all the holidays that would appear in a complete Hebrew | |
738 calendar." | |
739 :type 'boolean | |
740 :group 'holidays) | |
741 | |
895 (defvar hebrew-holidays-1 | 742 (defvar hebrew-holidays-1 |
896 '((holiday-rosh-hashanah-etc) | 743 '((holiday-rosh-hashanah-etc) |
897 (if all-hebrew-calendar-holidays | 744 (if all-hebrew-calendar-holidays |
898 (holiday-julian | 745 (holiday-julian |
899 11 | 746 11 |
906 (calendar-absolute-from-gregorian | 753 (calendar-absolute-from-gregorian |
907 (list m 1 y)))))) | 754 (list m 1 y)))))) |
908 (if (zerop (% (1+ year) 4)) | 755 (if (zerop (% (1+ year) 4)) |
909 22 | 756 22 |
910 21))) "\"Tal Umatar\" (evening)")))) | 757 21))) "\"Tal Umatar\" (evening)")))) |
911 | |
912 ;;;###autoload | 758 ;;;###autoload |
913 (put 'hebrew-holidays-2 'risky-local-variable t) | 759 (put 'hebrew-holidays-1 'risky-local-variable t) |
760 | |
914 (defvar hebrew-holidays-2 | 761 (defvar hebrew-holidays-2 |
915 '((if all-hebrew-calendar-holidays | 762 '((if all-hebrew-calendar-holidays |
916 (holiday-hanukkah) | 763 (holiday-hanukkah) |
917 (holiday-hebrew 9 25 "Hanukkah")) | 764 (holiday-hebrew 9 25 "Hanukkah")) |
918 (if all-hebrew-calendar-holidays | 765 (if all-hebrew-calendar-holidays |
927 6) | 774 6) |
928 11 10)) | 775 11 10)) |
929 "Tzom Teveth")) | 776 "Tzom Teveth")) |
930 (if all-hebrew-calendar-holidays | 777 (if all-hebrew-calendar-holidays |
931 (holiday-hebrew 11 15 "Tu B'Shevat")))) | 778 (holiday-hebrew 11 15 "Tu B'Shevat")))) |
932 | |
933 ;;;###autoload | 779 ;;;###autoload |
934 (put 'hebrew-holidays-3 'risky-local-variable t) | 780 (put 'hebrew-holidays-2 'risky-local-variable t) |
781 | |
935 (defvar hebrew-holidays-3 | 782 (defvar hebrew-holidays-3 |
936 '((if all-hebrew-calendar-holidays | 783 '((if all-hebrew-calendar-holidays |
937 (holiday-hebrew | 784 (holiday-hebrew |
938 11 | 785 11 |
939 (let ((m displayed-month) | 786 (let ((m displayed-month) |
959 6 (calendar-absolute-from-hebrew | 806 6 (calendar-absolute-from-hebrew |
960 (list 11 16 h-year)))))) | 807 (list 11 16 h-year)))))) |
961 (day (extract-calendar-day s-s))) | 808 (day (extract-calendar-day s-s))) |
962 day)) | 809 day)) |
963 "Shabbat Shirah")))) | 810 "Shabbat Shirah")))) |
964 | |
965 ;;;###autoload | 811 ;;;###autoload |
966 (put 'hebrew-holidays-4 'risky-local-variable t) | 812 (put 'hebrew-holidays-3 'risky-local-variable t) |
813 | |
967 (defvar hebrew-holidays-4 | 814 (defvar hebrew-holidays-4 |
968 '((holiday-passover-etc) | 815 '((holiday-passover-etc) |
969 (if (and all-hebrew-calendar-holidays | 816 (if (and all-hebrew-calendar-holidays |
970 (let* ((m displayed-month) | 817 (let* ((m displayed-month) |
971 (y displayed-year) | 818 (y displayed-year) |
977 (list m 1 y)))))) | 824 (list m 1 y)))))) |
978 (= 21 (% year 28))))) | 825 (= 21 (% year 28))))) |
979 (holiday-julian 3 26 "Kiddush HaHamah")) | 826 (holiday-julian 3 26 "Kiddush HaHamah")) |
980 (if all-hebrew-calendar-holidays | 827 (if all-hebrew-calendar-holidays |
981 (holiday-tisha-b-av-etc)))) | 828 (holiday-tisha-b-av-etc)))) |
982 | |
983 ;;;###autoload | 829 ;;;###autoload |
984 (put 'hebrew-holidays 'risky-local-variable t) | 830 (put 'hebrew-holidays-4 'risky-local-variable t) |
831 | |
985 (defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2 | 832 (defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2 |
986 hebrew-holidays-3 hebrew-holidays-4) | 833 hebrew-holidays-3 hebrew-holidays-4) |
987 "Jewish holidays. | 834 "Jewish holidays. |
988 See the documentation for `calendar-holidays' for details." | 835 See the documentation for `calendar-holidays' for details." |
989 :type 'sexp | 836 :type 'sexp |
990 :group 'holidays) | 837 :group 'holidays) |
991 | |
992 ;;;###autoload | 838 ;;;###autoload |
993 (put 'christian-holidays 'risky-local-variable t) | 839 (put 'hebrew-holidays 'risky-local-variable t) |
840 | |
841 (defcustom all-christian-calendar-holidays nil | |
842 "If nil, show only major holidays from the Christian calendar. | |
843 This means only those Christian holidays that appear on secular calendars. | |
844 Otherwise, show all the holidays that would appear in a complete Christian | |
845 calendar." | |
846 :type 'boolean | |
847 :group 'holidays) | |
848 | |
994 (defcustom christian-holidays | 849 (defcustom christian-holidays |
995 '((if all-christian-calendar-holidays | 850 '((if all-christian-calendar-holidays |
996 (holiday-fixed 1 6 "Epiphany")) | 851 (holiday-fixed 1 6 "Epiphany")) |
997 (holiday-easter-etc 0 "Easter Sunday") | 852 (holiday-easter-etc 0 "Easter Sunday") |
998 (holiday-easter-etc -2 "Good Friday") | 853 (holiday-easter-etc -2 "Good Friday") |
1036 (holiday-julian 12 25 "Eastern Orthodox Christmas"))) | 891 (holiday-julian 12 25 "Eastern Orthodox Christmas"))) |
1037 "Christian holidays. | 892 "Christian holidays. |
1038 See the documentation for `calendar-holidays' for details." | 893 See the documentation for `calendar-holidays' for details." |
1039 :type 'sexp | 894 :type 'sexp |
1040 :group 'holidays) | 895 :group 'holidays) |
1041 | |
1042 ;;;###autoload | 896 ;;;###autoload |
1043 (put 'islamic-holidays 'risky-local-variable t) | 897 (put 'christian-holidays 'risky-local-variable t) |
898 | |
899 (defcustom all-islamic-calendar-holidays nil | |
900 "If nil, show only major holidays from the Islamic calendar. | |
901 This means only those Islamic holidays that appear on secular calendars. | |
902 Otherwise, show all the holidays that would appear in a complete Islamic | |
903 calendar." | |
904 :type 'boolean | |
905 :group 'holidays) | |
906 | |
1044 (defcustom islamic-holidays | 907 (defcustom islamic-holidays |
1045 '((holiday-islamic | 908 '((holiday-islamic |
1046 1 1 | 909 1 1 |
1047 (format "Islamic New Year %d" | 910 (format "Islamic New Year %d" |
1048 (let ((m displayed-month) | 911 (let ((m displayed-month) |
1070 (holiday-islamic 12 10 "Id-al-Adha"))) | 933 (holiday-islamic 12 10 "Id-al-Adha"))) |
1071 "Islamic holidays. | 934 "Islamic holidays. |
1072 See the documentation for `calendar-holidays' for details." | 935 See the documentation for `calendar-holidays' for details." |
1073 :type 'sexp | 936 :type 'sexp |
1074 :group 'holidays) | 937 :group 'holidays) |
1075 | |
1076 ;;;###autoload | 938 ;;;###autoload |
1077 (put 'bahai-holidays 'risky-local-variable t) | 939 (put 'islamic-holidays 'risky-local-variable t) |
940 | |
941 (defcustom all-bahai-calendar-holidays nil | |
942 "If nil, show only major holidays from the Baha'i calendar. | |
943 These are the days on which work and school must be suspended. | |
944 Otherwise, show all the holidays that would appear in a complete Baha'i | |
945 calendar." | |
946 :type 'boolean | |
947 :group 'holidays) | |
948 | |
1078 (defcustom bahai-holidays | 949 (defcustom bahai-holidays |
1079 '((holiday-fixed | 950 '((holiday-fixed |
1080 3 21 | 951 3 21 |
1081 (format "Baha'i New Year (Naw-Ruz) %d" (- displayed-year (1- 1844)))) | 952 (format "Baha'i New Year (Naw-Ruz) %d" (- displayed-year (1- 1844)))) |
1082 (holiday-fixed 4 21 "First Day of Ridvan") | 953 (holiday-fixed 4 21 "First Day of Ridvan") |
1111 (holiday-fixed 11 28 "Ascension of `Abdu'l-Baha"))) | 982 (holiday-fixed 11 28 "Ascension of `Abdu'l-Baha"))) |
1112 "Baha'i holidays. | 983 "Baha'i holidays. |
1113 See the documentation for `calendar-holidays' for details." | 984 See the documentation for `calendar-holidays' for details." |
1114 :type 'sexp | 985 :type 'sexp |
1115 :group 'holidays) | 986 :group 'holidays) |
1116 | |
1117 ;;;###autoload | 987 ;;;###autoload |
1118 (put 'solar-holidays 'risky-local-variable t) | 988 (put 'bahai-holidays 'risky-local-variable t) |
989 | |
1119 (defcustom solar-holidays | 990 (defcustom solar-holidays |
1120 '((if (fboundp 'atan) | 991 '((if (fboundp 'atan) |
1121 (solar-equinoxes-solstices)) | 992 (solar-equinoxes-solstices)) |
1122 (if (progn | 993 (if (require 'cal-dst) |
1123 (require 'cal-dst) | |
1124 t) | |
1125 (funcall | 994 (funcall |
1126 'holiday-sexp | 995 'holiday-sexp |
1127 calendar-daylight-savings-starts | 996 calendar-daylight-savings-starts |
1128 '(format "Daylight Saving Time Begins %s" | 997 '(format "Daylight Saving Time Begins %s" |
1129 (if (fboundp 'atan) | 998 (if (fboundp 'atan) |
1142 "")))) | 1011 "")))) |
1143 "Sun-related holidays. | 1012 "Sun-related holidays. |
1144 See the documentation for `calendar-holidays' for details." | 1013 See the documentation for `calendar-holidays' for details." |
1145 :type 'sexp | 1014 :type 'sexp |
1146 :group 'holidays) | 1015 :group 'holidays) |
1147 | |
1148 ;;;###autoload | 1016 ;;;###autoload |
1149 (put 'calendar-holidays 'risky-local-variable t) | 1017 (put 'solar-holidays 'risky-local-variable t) |
1018 | |
1150 (defcustom calendar-holidays | 1019 (defcustom calendar-holidays |
1151 (append general-holidays local-holidays other-holidays | 1020 (append general-holidays local-holidays other-holidays |
1152 christian-holidays hebrew-holidays islamic-holidays | 1021 christian-holidays hebrew-holidays islamic-holidays |
1153 bahai-holidays oriental-holidays solar-holidays) | 1022 bahai-holidays oriental-holidays solar-holidays) |
1154 "List of notable days for the command \\[holidays]. | 1023 "List of notable days for the command \\[holidays]. |
1255 with descriptive strings such as | 1124 with descriptive strings such as |
1256 | 1125 |
1257 (((2 6 1989) \"New Moon\") ((2 12 1989) \"First Quarter Moon\") ... )." | 1126 (((2 6 1989) \"New Moon\") ((2 12 1989) \"First Quarter Moon\") ... )." |
1258 :type 'sexp | 1127 :type 'sexp |
1259 :group 'holidays) | 1128 :group 'holidays) |
1129 ;;;###autoload | |
1130 (put 'calendar-holidays 'risky-local-variable t) | |
1131 | |
1132 ;;; End of user options. | |
1133 | |
1134 (defconst calendar-buffer "*Calendar*" | |
1135 "Name of the buffer used for the calendar.") | |
1260 | 1136 |
1261 (defconst holiday-buffer "*Holidays*" | 1137 (defconst holiday-buffer "*Holidays*" |
1262 "Name of the buffer used for the displaying the holidays.") | 1138 "Name of the buffer used for the displaying the holidays.") |
1263 | 1139 |
1264 (defconst fancy-diary-buffer "*Fancy Diary Entries*" | 1140 (defconst fancy-diary-buffer "*Fancy Diary Entries*" |
1419 (* 365 offset-years) | 1295 (* 365 offset-years) |
1420 (/ offset-years 4) | 1296 (/ offset-years 4) |
1421 (- (/ offset-years 100)) | 1297 (- (/ offset-years 100)) |
1422 (/ offset-years 400) | 1298 (/ offset-years 400) |
1423 (calendar-day-number '(12 31 -1))))))) ; days in year 1 BC | 1299 (calendar-day-number '(12 31 -1))))))) ; days in year 1 BC |
1424 | |
1425 (autoload 'calendar-goto-today "cal-move" | |
1426 "Reposition the calendar window so the current date is visible." | |
1427 t) | |
1428 | |
1429 (autoload 'calendar-forward-month "cal-move" | |
1430 "Move the cursor forward ARG months." | |
1431 t) | |
1432 | |
1433 (autoload 'calendar-forward-year "cal-move" | |
1434 "Move the cursor forward by ARG years." | |
1435 t) | |
1436 | |
1437 (autoload 'calendar-backward-month "cal-move" | |
1438 "Move the cursor backward by ARG months." | |
1439 t) | |
1440 | |
1441 (autoload 'calendar-backward-year "cal-move" | |
1442 "Move the cursor backward ARG years." | |
1443 t) | |
1444 | |
1445 (autoload 'calendar-scroll-left "cal-move" | |
1446 "Scroll the displayed calendar left by ARG months." | |
1447 t) | |
1448 | |
1449 (autoload 'calendar-scroll-right "cal-move" | |
1450 "Scroll the displayed calendar window right by ARG months." | |
1451 t) | |
1452 | |
1453 (autoload 'calendar-scroll-left-three-months "cal-move" | |
1454 "Scroll the displayed calendar window left by 3*ARG months." | |
1455 t) | |
1456 | |
1457 (autoload 'calendar-scroll-right-three-months "cal-move" | |
1458 "Scroll the displayed calendar window right by 3*ARG months." | |
1459 t) | |
1460 | |
1461 (autoload 'calendar-cursor-to-nearest-date "cal-move" | |
1462 "Move the cursor to the closest date." | |
1463 t) | |
1464 | |
1465 (autoload 'calendar-forward-day "cal-move" | |
1466 "Move the cursor forward ARG days." | |
1467 t) | |
1468 | |
1469 (autoload 'calendar-backward-day "cal-move" | |
1470 "Move the cursor back ARG days." | |
1471 t) | |
1472 | |
1473 (autoload 'calendar-forward-week "cal-move" | |
1474 "Move the cursor forward ARG weeks." | |
1475 t) | |
1476 | |
1477 (autoload 'calendar-backward-week "cal-move" | |
1478 "Move the cursor back ARG weeks." | |
1479 t) | |
1480 | |
1481 (autoload 'calendar-beginning-of-week "cal-move" | |
1482 "Move the cursor back ARG calendar-week-start-day's." | |
1483 t) | |
1484 | |
1485 (autoload 'calendar-end-of-week "cal-move" | |
1486 "Move the cursor forward ARG calendar-week-start-day+6's." | |
1487 t) | |
1488 | |
1489 (autoload 'calendar-beginning-of-month "cal-move" | |
1490 "Move the cursor backward ARG month beginnings." | |
1491 t) | |
1492 | |
1493 (autoload 'calendar-end-of-month "cal-move" | |
1494 "Move the cursor forward ARG month ends." | |
1495 t) | |
1496 | |
1497 (autoload 'calendar-beginning-of-year "cal-move" | |
1498 "Move the cursor backward ARG year beginnings." | |
1499 t) | |
1500 | |
1501 (autoload 'calendar-end-of-year "cal-move" | |
1502 "Move the cursor forward ARG year beginnings." | |
1503 t) | |
1504 | |
1505 (autoload 'calendar-cursor-to-visible-date "cal-move" | |
1506 "Move the cursor to DATE that is on the screen." | |
1507 t) | |
1508 | |
1509 (autoload 'calendar-goto-date "cal-move" | |
1510 "Move cursor to DATE." | |
1511 t) | |
1512 | |
1513 (autoload 'calendar-goto-day-of-year "cal-move" | |
1514 "Move cursor to day of year." | |
1515 t) | |
1516 | |
1517 (autoload 'calendar-only-one-frame-setup "cal-x" | |
1518 "Start calendar and display it in a dedicated frame.") | |
1519 | |
1520 (autoload 'calendar-one-frame-setup "cal-x" | |
1521 "Start calendar and display it in a dedicated frame together with the diary.") | |
1522 | |
1523 (autoload 'calendar-two-frame-setup "cal-x" | |
1524 "Start calendar and diary in separate, dedicated frames.") | |
1525 | |
1526 (defcustom calendar-setup nil | |
1527 "The frame setup of the calendar. | |
1528 The choices are: `one-frame' (calendar and diary together in one separate, | |
1529 dedicated frame); `two-frames' (calendar and diary in separate, dedicated | |
1530 frames); `calendar-only' (calendar in a separate, dedicated frame); with | |
1531 any other value the current frame is used. Using any of the first | |
1532 three options overrides the value of `view-diary-entries-initially'." | |
1533 :type '(choice | |
1534 (const :tag "calendar and diary in separate frame" one-frame) | |
1535 (const :tag "calendar and diary each in own frame" two-frames) | |
1536 (const :tag "calendar in separate frame" calendar-only) | |
1537 (const :tag "use current frame" nil)) | |
1538 :group 'calendar) | |
1539 | |
1540 (defcustom calendar-minimum-window-height 8 | |
1541 "Minimum height `generate-calendar-window' should use for calendar window." | |
1542 :type 'integer | |
1543 :version "22.1" | |
1544 :group 'calendar) | |
1545 | |
1546 (defcustom calendar-week-start-day 0 | |
1547 "The day of the week on which a week in the calendar begins. | |
1548 0 means Sunday (default), 1 means Monday, and so on. | |
1549 | |
1550 If you change this variable directly (without using customize) | |
1551 after starting `calendar', you should call `redraw-calendar' to | |
1552 update the calendar display to reflect the change, otherwise | |
1553 movement commands will not work correctly." | |
1554 :type 'integer | |
1555 ;; Change the initialize so that if you reload calendar.el, it will not | |
1556 ;; cause a redraw (which may fail, e.g. with "invalid byte-code in | |
1557 ;; calendar.elc" because of the "byte-compile-dynamic"). | |
1558 :initialize 'custom-initialize-default | |
1559 :set (lambda (sym val) | |
1560 (set sym val) | |
1561 (redraw-calendar)) | |
1562 :group 'calendar) | |
1563 | |
1564 (defcustom calendar-debug-sexp nil | |
1565 "Turn debugging on when evaluating a sexp in the diary or holiday list." | |
1566 :type 'boolean | |
1567 :group 'calendar) | |
1568 | |
1569 | 1300 |
1570 ;;;###autoload | 1301 ;;;###autoload |
1571 (defun calendar (&optional arg) | 1302 (defun calendar (&optional arg) |
1572 "Choose between the one frame, two frame, or basic calendar displays. | 1303 "Choose between the one frame, two frame, or basic calendar displays. |
1573 If called with an optional prefix argument, prompts for month and year. | 1304 If called with an optional prefix argument, prompts for month and year. |
1676 | 1407 |
1677 (autoload 'calendar-phases-of-moon "lunar" | 1408 (autoload 'calendar-phases-of-moon "lunar" |
1678 "Create a buffer of the phases of the moon for the current calendar window." | 1409 "Create a buffer of the phases of the moon for the current calendar window." |
1679 t) | 1410 t) |
1680 | 1411 |
1681 (autoload 'calendar-print-french-date "cal-french" | |
1682 "Show the French Revolutionary calendar equivalent of the date under the cursor." | |
1683 t) | |
1684 | |
1685 (autoload 'calendar-goto-french-date "cal-french" | |
1686 "Move cursor to French Revolutionary date." | |
1687 t) | |
1688 | |
1689 (autoload 'calendar-french-date-string "cal-french" | |
1690 "String of French Revolutionary date of Gregorian date.") | |
1691 | |
1692 (autoload 'calendar-mayan-date-string "cal-mayan" | |
1693 "String of Mayan date of Gregorian date.") | |
1694 | |
1695 (autoload 'calendar-print-mayan-date "cal-mayan" | |
1696 "Show the Mayan long count, Tzolkin, and Haab equivalents of the date under the cursor." | |
1697 t) | |
1698 | |
1699 (autoload 'calendar-goto-mayan-long-count-date "cal-mayan" | |
1700 "Move cursor to Mayan long count date." | |
1701 t) | |
1702 | |
1703 (autoload 'calendar-next-haab-date "cal-mayan" | |
1704 "Move cursor to next instance of Mayan Haab date." | |
1705 t) | |
1706 | |
1707 (autoload 'calendar-previous-haab-date "cal-mayan" | |
1708 "Move cursor to previous instance of Mayan Haab date." | |
1709 t) | |
1710 | |
1711 (autoload 'calendar-next-tzolkin-date "cal-mayan" | |
1712 "Move cursor to next instance of Mayan Tzolkin date." | |
1713 t) | |
1714 | |
1715 (autoload 'calendar-previous-tzolkin-date "cal-mayan" | |
1716 "Move cursor to previous instance of Mayan Tzolkin date." | |
1717 t) | |
1718 | |
1719 (autoload 'calendar-next-calendar-round-date "cal-mayan" | |
1720 "Move cursor to next instance of Mayan Haab/Tzolkin combination." | |
1721 t) | |
1722 | |
1723 (autoload 'calendar-previous-calendar-round-date "cal-mayan" | |
1724 "Move cursor to previous instance of Mayan Haab/Tzolkin combination." | |
1725 t) | |
1726 | |
1727 (autoload 'calendar-goto-chinese-date "cal-china" | |
1728 "Move cursor to Chinese date." | |
1729 t) | |
1730 | |
1731 (autoload 'calendar-print-chinese-date "cal-china" | |
1732 "Show the Chinese date equivalents of date." | |
1733 t) | |
1734 | |
1735 (autoload 'calendar-chinese-date-string "cal-china" | |
1736 "String of Chinese date of Gregorian date.") | |
1737 | |
1738 (autoload 'calendar-absolute-from-astro "cal-julian" | |
1739 "Absolute date of astronomical (Julian) day number D." | |
1740 t ) | |
1741 | |
1742 (autoload 'calendar-astro-from-absolute "cal-julian" | |
1743 "Astronomical (Julian) day number of absolute date D.") | |
1744 | |
1745 (autoload 'calendar-astro-date-string "cal-julian" | |
1746 "String of astronomical (Julian) day number of Gregorian date.") | |
1747 | |
1748 (autoload 'calendar-goto-astro-day-number "cal-julian" | |
1749 "Move cursor to astronomical (Julian) day number." | |
1750 t) | |
1751 | |
1752 (autoload 'calendar-print-astro-day-number "cal-julian" | |
1753 "Show the astro date equivalents of date." | |
1754 t) | |
1755 | |
1756 (autoload 'calendar-julian-from-absolute "cal-julian" | |
1757 "Compute the Julian (month day year) corresponding to the absolute DATE. | |
1758 The absolute date is the number of days elapsed since the (imaginary) | |
1759 Gregorian date Sunday, December 31, 1 BC.") | |
1760 | |
1761 (autoload 'calendar-goto-julian-date "cal-julian" | |
1762 "Move cursor to Julian DATE; echo Julian date unless NOECHO is t." | |
1763 t) | |
1764 | |
1765 (autoload 'calendar-print-julian-date "cal-julian" | |
1766 "Show the Julian calendar equivalent of the date under the cursor." | |
1767 t) | |
1768 | |
1769 (autoload 'calendar-julian-date-string "cal-julian" | |
1770 "String of Julian date of Gregorian DATE. | |
1771 Defaults to today's date if DATE is not given. | |
1772 Driven by the variable `calendar-date-display-form'.") | |
1773 | |
1774 (autoload 'calendar-goto-iso-date "cal-iso" | |
1775 "Move cursor to ISO date." | |
1776 t) | |
1777 | |
1778 (autoload 'calendar-goto-iso-week "cal-iso" | |
1779 "Move cursor to start of ISO week." | |
1780 t) | |
1781 | |
1782 (autoload 'calendar-print-iso-date "cal-iso" | |
1783 "Show the ISO date equivalents of date." | |
1784 t) | |
1785 | |
1786 (autoload 'calendar-iso-date-string "cal-iso" | |
1787 "String of ISO date of Gregorian date.") | |
1788 | |
1789 (autoload 'calendar-goto-islamic-date "cal-islam" | |
1790 "Move cursor to Islamic date." | |
1791 t) | |
1792 | |
1793 (autoload 'calendar-print-islamic-date "cal-islam" | |
1794 "Show the Islamic date equivalents of date." | |
1795 t) | |
1796 | |
1797 (autoload 'calendar-islamic-date-string "cal-islam" | |
1798 "String of Islamic date of Gregorian date.") | |
1799 | |
1800 (autoload 'calendar-bahai-goto-date "cal-bahai" | |
1801 "Move cursor to Baha'i date DATE. | |
1802 Echo Baha'i date unless NOECHO is t." | |
1803 t) | |
1804 | |
1805 (autoload 'calendar-print-bahai-date "cal-bahai" | |
1806 "Show the Baha'i date equivalents of date." | |
1807 t) | |
1808 | |
1809 (autoload 'calendar-bahai-date-string "cal-bahai" | |
1810 "String of Baha'i date of Gregorian date.") | |
1811 | |
1812 (autoload 'calendar-goto-hebrew-date "cal-hebrew" | 1412 (autoload 'calendar-goto-hebrew-date "cal-hebrew" |
1813 "Move cursor to Hebrew date." | 1413 "Move cursor to Hebrew date." |
1814 t) | 1414 t) |
1815 | 1415 |
1816 (autoload 'calendar-print-hebrew-date "cal-hebrew" | 1416 (autoload 'calendar-print-hebrew-date "cal-hebrew" |
1817 "Show the Hebrew date equivalents of date." | 1417 "Show the Hebrew date equivalents of date." |
1818 t) | 1418 t) |
1819 | 1419 |
1820 (autoload 'calendar-hebrew-date-string "cal-hebrew" | 1420 (autoload 'calendar-hebrew-date-string "cal-hebrew" |
1821 "String of Hebrew date of Gregorian date.") | 1421 "String of Hebrew date of Gregorian date.") |
1822 | |
1823 (autoload 'calendar-goto-coptic-date "cal-coptic" | |
1824 "Move cursor to Coptic date." | |
1825 t) | |
1826 | |
1827 (autoload 'calendar-print-coptic-date "cal-coptic" | |
1828 "Show the Coptic date equivalents of date." | |
1829 t) | |
1830 | |
1831 (autoload 'calendar-coptic-date-string "cal-coptic" | |
1832 "String of Coptic date of Gregorian date.") | |
1833 | |
1834 (autoload 'calendar-goto-ethiopic-date "cal-coptic" | |
1835 "Move cursor to Ethiopic date." | |
1836 t) | |
1837 | |
1838 (autoload 'calendar-print-ethiopic-date "cal-coptic" | |
1839 "Show the Ethiopic date equivalents of date." | |
1840 t) | |
1841 | |
1842 (autoload 'calendar-ethiopic-date-string "cal-coptic" | |
1843 "String of Ethiopic date of Gregorian date.") | |
1844 | |
1845 (autoload 'calendar-goto-persian-date "cal-persia" | |
1846 "Move cursor to Persian date." | |
1847 t) | |
1848 | |
1849 (autoload 'calendar-print-persian-date "cal-persia" | |
1850 "Show the Persian date equivalents of date." | |
1851 t) | |
1852 | |
1853 (autoload 'calendar-persian-date-string "cal-persia" | |
1854 "String of Persian date of Gregorian date.") | |
1855 | 1422 |
1856 (autoload 'diary-show-all-entries "diary-lib" | 1423 (autoload 'diary-show-all-entries "diary-lib" |
1857 "Show all of the diary entries in the diary file. | 1424 "Show all of the diary entries in the diary file. |
1858 This function gets rid of the selective display of the diary file so that | 1425 This function gets rid of the selective display of the diary file so that |
1859 all entries, not just some, are visible. If there is no diary buffer, one | 1426 all entries, not just some, are visible. If there is no diary buffer, one |
1874 | 1441 |
1875 (autoload 'insert-weekly-diary-entry "diary-lib" | 1442 (autoload 'insert-weekly-diary-entry "diary-lib" |
1876 "Insert a weekly diary entry for the day of the week indicated by point." | 1443 "Insert a weekly diary entry for the day of the week indicated by point." |
1877 t) | 1444 t) |
1878 | 1445 |
1879 | |
1880 (autoload 'insert-monthly-diary-entry "diary-lib" | 1446 (autoload 'insert-monthly-diary-entry "diary-lib" |
1881 "Insert a monthly diary entry for the day of the month indicated by point." | 1447 "Insert a monthly diary entry for the day of the month indicated by point." |
1882 t) | 1448 t) |
1883 | 1449 |
1884 (autoload 'insert-yearly-diary-entry "diary-lib" | 1450 (autoload 'insert-yearly-diary-entry "diary-lib" |
1909 | 1475 |
1910 (autoload 'insert-yearly-hebrew-diary-entry "cal-hebrew" | 1476 (autoload 'insert-yearly-hebrew-diary-entry "cal-hebrew" |
1911 "Insert an annual diary entry for the day of the Hebrew year corresponding | 1477 "Insert an annual diary entry for the day of the Hebrew year corresponding |
1912 to the date indicated by point." | 1478 to the date indicated by point." |
1913 t) | 1479 t) |
1914 | |
1915 (autoload 'insert-islamic-diary-entry "cal-islam" | |
1916 "Insert a diary entry for the Islamic date corresponding to the date | |
1917 indicated by point." | |
1918 t) | |
1919 | |
1920 (autoload 'insert-monthly-islamic-diary-entry "cal-islam" | |
1921 "Insert a monthly diary entry for the day of the Islamic month corresponding | |
1922 to the date indicated by point." | |
1923 t) | |
1924 | |
1925 (autoload 'insert-yearly-islamic-diary-entry "cal-islam" | |
1926 "Insert an annual diary entry for the day of the Islamic year corresponding | |
1927 to the date indicated by point." | |
1928 t) | |
1929 | |
1930 (autoload 'diary-bahai-insert-entry "cal-bahai" | |
1931 "Insert a diary entry for the Baha'i date corresponding to the date | |
1932 indicated by point." | |
1933 t) | |
1934 | |
1935 (autoload 'diary-bahai-insert-monthly-entry "cal-bahai" | |
1936 "Insert a monthly diary entry for the day of the Baha'i month corresponding | |
1937 to the date indicated by point." | |
1938 t) | |
1939 | |
1940 (autoload 'diary-bahai-insert-yearly-entry "cal-bahai" | |
1941 "Insert an annual diary entry for the day of the Baha'i year corresponding | |
1942 to the date indicated by point." | |
1943 t) | |
1944 | |
1945 (autoload 'cal-tex-cursor-month "cal-tex" | |
1946 "Make a buffer with LaTeX commands for the month cursor is on. | |
1947 Optional prefix argument specifies number of months to be produced. | |
1948 Calendar is condensed onto one page." t) | |
1949 | |
1950 (autoload 'cal-tex-cursor-month-landscape "cal-tex" | |
1951 "Make a buffer with LaTeX commands for the month cursor is on. | |
1952 Optional prefix argument specifies number of months to be produced." t) | |
1953 | |
1954 (autoload 'cal-tex-cursor-day "cal-tex" | |
1955 "Make a buffer with LaTeX commands for the day cursor is on." t) | |
1956 | |
1957 (autoload 'cal-tex-cursor-week "cal-tex" | |
1958 "Make a buffer with LaTeX commands for a two-page one-week calendar. | |
1959 It applies to the week that point is in. | |
1960 Optional prefix argument specifies number of weeks. | |
1961 Holidays are included if `cal-tex-holidays' is t." t) | |
1962 | |
1963 (autoload 'cal-tex-cursor-week2 "cal-tex" | |
1964 "Make a buffer with LaTeX commands for a two-page one-week calendar. | |
1965 It applies to the week that point is in. | |
1966 Optional prefix argument specifies number of weeks. | |
1967 Holidays are included if `cal-tex-holidays' is t." t) | |
1968 | |
1969 (autoload 'cal-tex-cursor-week-iso "cal-tex" | |
1970 "Make a buffer with LaTeX commands for a one page ISO-style weekly calendar. | |
1971 Optional prefix argument specifies number of weeks. | |
1972 Diary entries are included if `cal-tex-diary' is t. | |
1973 Holidays are included if `cal-tex-holidays' is t." t) | |
1974 | |
1975 (autoload 'cal-tex-cursor-week-monday "cal-tex" | |
1976 "Make a buffer with LaTeX commands for a two-page one-week calendar. | |
1977 It applies to the week that point is in, and starts on Monday. | |
1978 Optional prefix argument specifies number of weeks. | |
1979 Holidays are included if `cal-tex-holidays' is t." t) | |
1980 | |
1981 (autoload 'cal-tex-cursor-filofax-2week "cal-tex" | |
1982 "Two-weeks-at-a-glance Filofax style calendar for week indicated by cursor. | |
1983 Optional prefix argument specifies number of weeks. | |
1984 Diary entries are included if cal-tex-diary is t. | |
1985 Holidays are included if `cal-tex-holidays' is t." t) | |
1986 | |
1987 (autoload 'cal-tex-cursor-filofax-week "cal-tex" | |
1988 "One-week-at-a-glance Filofax style calendar for week indicated by cursor. | |
1989 Optional prefix argument specifies number of weeks. | |
1990 Weeks start on Monday. | |
1991 Diary entries are included if cal-tex-diary is t. | |
1992 Holidays are included if `cal-tex-holidays' is t." t) | |
1993 | |
1994 (autoload 'cal-tex-cursor-filofax-daily "cal-tex" | |
1995 "Day-per-page Filofax style calendar for week indicated by cursor. | |
1996 Optional prefix argument specifies number of weeks. Weeks start on Monday. | |
1997 Diary entries are included if `cal-tex-diary' is t. | |
1998 Holidays are included if `cal-tex-holidays' is t." t) | |
1999 | |
2000 (autoload 'cal-tex-cursor-year "cal-tex" | |
2001 "Make a buffer with LaTeX commands for a year's calendar. | |
2002 Optional prefix argument specifies number of years." t) | |
2003 | |
2004 (autoload 'cal-tex-cursor-year-landscape "cal-tex" | |
2005 "Make a buffer with LaTeX commands for a year's calendar (landscape). | |
2006 Optional prefix argument specifies number of years." t) | |
2007 | |
2008 (autoload 'cal-tex-cursor-filofax-year "cal-tex" | |
2009 "Make a buffer with LaTeX commands for a year's calendar (Filofax). | |
2010 Optional prefix argument specifies number of years." t) | |
2011 | |
2012 (autoload 'cal-html-cursor-month "cal-html" | |
2013 "Write an HTML calendar file for numeric MONTH of four-digit YEAR. | |
2014 The output directory DIR is created if necessary. Interactively, | |
2015 MONTH and YEAR are taken from the calendar cursor position. Note | |
2016 that any existing output files are overwritten." t) | |
2017 | |
2018 (autoload 'cal-html-cursor-year "cal-html" | |
2019 "Write HTML calendar files (index and monthly pages) for four-digit YEAR. | |
2020 The output directory DIR is created if necessary. Interactively, | |
2021 YEAR is taken from the calendar cursor position. Note that any | |
2022 existing output files are overwritten." t) | |
2023 | 1480 |
2024 (autoload 'mark-calendar-holidays "holidays" | 1481 (autoload 'mark-calendar-holidays "holidays" |
2025 "Mark notable days in the calendar window." | 1482 "Mark notable days in the calendar window." |
2026 t) | 1483 t) |
2027 | 1484 |
2157 (if (get-buffer calendar-buffer) | 1614 (if (get-buffer calendar-buffer) |
2158 (with-current-buffer calendar-buffer | 1615 (with-current-buffer calendar-buffer |
2159 (let ((cursor-date (calendar-cursor-to-nearest-date))) | 1616 (let ((cursor-date (calendar-cursor-to-nearest-date))) |
2160 (generate-calendar-window displayed-month displayed-year) | 1617 (generate-calendar-window displayed-month displayed-year) |
2161 (calendar-cursor-to-visible-date cursor-date))))) | 1618 (calendar-cursor-to-visible-date cursor-date))))) |
2162 | |
2163 (require 'cal-menu) | |
2164 | 1619 |
2165 (defvar calendar-mode-map | 1620 (defvar calendar-mode-map |
2166 (let ((map (make-keymap))) | 1621 (let ((map (make-keymap))) |
2167 (suppress-keymap map) | 1622 (suppress-keymap map) |
2168 (dolist (c '(narrow-to-region mark-word mark-sexp mark-paragraph | 1623 (dolist (c '(narrow-to-region mark-word mark-sexp mark-paragraph |
2395 (defun calendar-goto-info-node () | 1850 (defun calendar-goto-info-node () |
2396 "Go to the info node for the calendar." | 1851 "Go to the info node for the calendar." |
2397 (interactive) | 1852 (interactive) |
2398 (info "(emacs)Calendar/Diary")) | 1853 (info "(emacs)Calendar/Diary")) |
2399 | 1854 |
1855 (defvar calendar-mark-ring nil | |
1856 "Used by `calendar-set-mark'.") | |
1857 | |
1858 (defvar calendar-starred-day nil | |
1859 "Stores the value of the last date that `calendar-star-date' replaced.") | |
1860 | |
2400 (defun calendar-mode () | 1861 (defun calendar-mode () |
2401 "A major mode for the calendar window. | 1862 "A major mode for the calendar window. |
2402 | 1863 |
2403 For a complete description, type \ | 1864 For a complete description, type \ |
2404 \\<calendar-mode-map>\\[calendar-goto-info-node] from within the calendar. | 1865 \\<calendar-mode-map>\\[calendar-goto-info-node] from within the calendar. |
2405 | 1866 |
2406 \\<calendar-mode-map>\\{calendar-mode-map}" | 1867 \\<calendar-mode-map>\\{calendar-mode-map}" |
2407 (kill-all-local-variables) | 1868 (kill-all-local-variables) |
2408 (setq major-mode 'calendar-mode) | 1869 (setq major-mode 'calendar-mode |
2409 (setq mode-name "Calendar") | 1870 mode-name "Calendar" |
1871 buffer-read-only t | |
1872 indent-tabs-mode nil) | |
2410 (use-local-map calendar-mode-map) | 1873 (use-local-map calendar-mode-map) |
2411 (setq buffer-read-only t) | |
2412 (setq indent-tabs-mode nil) | |
2413 (update-calendar-mode-line) | 1874 (update-calendar-mode-line) |
2414 (make-local-variable 'calendar-mark-ring) | 1875 (make-local-variable 'calendar-mark-ring) |
1876 (make-local-variable 'calendar-starred-day) | |
2415 (make-local-variable 'displayed-month) ;; Month in middle of window. | 1877 (make-local-variable 'displayed-month) ;; Month in middle of window. |
2416 (make-local-variable 'displayed-year) ;; Year in middle of window. | 1878 (make-local-variable 'displayed-year) ;; Year in middle of window. |
2417 ;; Most functions only work if displayed-month and displayed-year are set, | 1879 ;; Most functions only work if displayed-month and displayed-year are set, |
2418 ;; so let's make sure they're always set. Most likely, this will be reset | 1880 ;; so let's make sure they're always set. Most likely, this will be reset |
2419 ;; soon in generate-calendar, but better safe than sorry. | 1881 ;; soon in generate-calendar, but better safe than sorry. |
2677 (let ((value (read-minibuffer prompt initial-contents))) | 2139 (let ((value (read-minibuffer prompt initial-contents))) |
2678 (while (not (funcall acceptable value)) | 2140 (while (not (funcall acceptable value)) |
2679 (setq value (read-minibuffer prompt initial-contents))) | 2141 (setq value (read-minibuffer prompt initial-contents))) |
2680 value)) | 2142 value)) |
2681 | 2143 |
2144 | |
2145 (defvar calendar-abbrev-length 3 | |
2146 "*Length of abbreviations to be used for day and month names. | |
2147 See also `calendar-day-abbrev-array' and `calendar-month-abbrev-array'.") | |
2148 | |
2149 (defvar calendar-day-name-array | |
2150 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] | |
2151 "*Array of capitalized strings giving, in order, the day names. | |
2152 The first two characters of each string will be used to head the | |
2153 day columns in the calendar. See also the variable | |
2154 `calendar-day-abbrev-array'.") | |
2155 | |
2156 (defvar calendar-day-abbrev-array | |
2157 [nil nil nil nil nil nil nil] | |
2158 "*Array of capitalized strings giving the abbreviated day names. | |
2159 The order should be the same as that of the full names specified | |
2160 in `calendar-day-name-array'. These abbreviations may be used | |
2161 instead of the full names in the diary file. Do not include a | |
2162 trailing `.' in the strings specified in this variable, though | |
2163 you may use such in the diary file. If any element of this array | |
2164 is nil, then the abbreviation will be constructed as the first | |
2165 `calendar-abbrev-length' characters of the corresponding full name.") | |
2166 | |
2167 (defvar calendar-month-name-array | |
2168 ["January" "February" "March" "April" "May" "June" | |
2169 "July" "August" "September" "October" "November" "December"] | |
2170 "*Array of capitalized strings giving, in order, the month names. | |
2171 See also the variable `calendar-month-abbrev-array'.") | |
2172 | |
2173 (defvar calendar-month-abbrev-array | |
2174 [nil nil nil nil nil nil nil nil nil nil nil nil] | |
2175 "*Array of capitalized strings giving the abbreviated month names. | |
2176 The order should be the same as that of the full names specified | |
2177 in `calendar-month-name-array'. These abbreviations are used in | |
2178 the calendar menu entries, and can also be used in the diary | |
2179 file. Do not include a trailing `.' in the strings specified in | |
2180 this variable, though you may use such in the diary file. If any | |
2181 element of this array is nil, then the abbreviation will be | |
2182 constructed as the first `calendar-abbrev-length' characters of the | |
2183 corresponding full name.") | |
2184 | |
2185 | |
2682 (defun calendar-read-date (&optional noday) | 2186 (defun calendar-read-date (&optional noday) |
2683 "Prompt for Gregorian date. Return a list (month day year). | 2187 "Prompt for Gregorian date. Return a list (month day year). |
2684 If optional NODAY is t, does not ask for day, but just returns | 2188 If optional NODAY is t, does not ask for day, but just returns |
2685 \(month nil year); if NODAY is any other non-nil value the value returned is | 2189 \(month nil year); if NODAY is any other non-nil value the value returned is |
2686 \(month year)" | 2190 \(month year)" |
2713 Negative years are interpreted as years BC; -1 being 1 BC, and so on." | 2217 Negative years are interpreted as years BC; -1 being 1 BC, and so on." |
2714 (if (< yr1 0) (setq yr1 (1+ yr1))) ; -1 BC -> 0 AD, etc | 2218 (if (< yr1 0) (setq yr1 (1+ yr1))) ; -1 BC -> 0 AD, etc |
2715 (if (< yr2 0) (setq yr2 (1+ yr2))) | 2219 (if (< yr2 0) (setq yr2 (1+ yr2))) |
2716 (+ (* 12 (- yr2 yr1)) | 2220 (+ (* 12 (- yr2 yr1)) |
2717 (- mon2 mon1))) | 2221 (- mon2 mon1))) |
2718 | |
2719 (defvar calendar-abbrev-length 3 | |
2720 "*Length of abbreviations to be used for day and month names. | |
2721 See also `calendar-day-abbrev-array' and `calendar-month-abbrev-array'.") | |
2722 | |
2723 (defvar calendar-day-name-array | |
2724 ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] | |
2725 "*Array of capitalized strings giving, in order, the day names. | |
2726 The first two characters of each string will be used to head the | |
2727 day columns in the calendar. See also the variable | |
2728 `calendar-day-abbrev-array'.") | |
2729 | |
2730 (defvar calendar-day-abbrev-array | |
2731 [nil nil nil nil nil nil nil] | |
2732 "*Array of capitalized strings giving the abbreviated day names. | |
2733 The order should be the same as that of the full names specified | |
2734 in `calendar-day-name-array'. These abbreviations may be used | |
2735 instead of the full names in the diary file. Do not include a | |
2736 trailing `.' in the strings specified in this variable, though | |
2737 you may use such in the diary file. If any element of this array | |
2738 is nil, then the abbreviation will be constructed as the first | |
2739 `calendar-abbrev-length' characters of the corresponding full name.") | |
2740 | |
2741 (defvar calendar-month-name-array | |
2742 ["January" "February" "March" "April" "May" "June" | |
2743 "July" "August" "September" "October" "November" "December"] | |
2744 "*Array of capitalized strings giving, in order, the month names. | |
2745 See also the variable `calendar-month-abbrev-array'.") | |
2746 | |
2747 (defvar calendar-month-abbrev-array | |
2748 [nil nil nil nil nil nil nil nil nil nil nil nil] | |
2749 "*Array of capitalized strings giving the abbreviated month names. | |
2750 The order should be the same as that of the full names specified | |
2751 in `calendar-month-name-array'. These abbreviations are used in | |
2752 the calendar menu entries, and can also be used in the diary | |
2753 file. Do not include a trailing `.' in the strings specified in | |
2754 this variable, though you may use such in the diary file. If any | |
2755 element of this array is nil, then the abbreviation will be | |
2756 constructed as the first `calendar-abbrev-length' characters of the | |
2757 corresponding full name.") | |
2758 | 2222 |
2759 (defun calendar-abbrev-construct (abbrev full &optional period) | 2223 (defun calendar-abbrev-construct (abbrev full &optional period) |
2760 "Internal calendar function to return a complete abbreviation array. | 2224 "Internal calendar function to return a complete abbreviation array. |
2761 ABBREV is an array of abbreviations, FULL the corresponding array | 2225 ABBREV is an array of abbreviations, FULL the corresponding array |
2762 of full names. The return value is the ABBREV array, with any nil | 2226 of full names. The return value is the ABBREV array, with any nil |
2943 This function can be used with the `today-visible-calendar-hook' run after the | 2407 This function can be used with the `today-visible-calendar-hook' run after the |
2944 calendar window has been prepared." | 2408 calendar window has been prepared." |
2945 (let ((inhibit-read-only t) | 2409 (let ((inhibit-read-only t) |
2946 (modified (buffer-modified-p))) | 2410 (modified (buffer-modified-p))) |
2947 (forward-char 1) | 2411 (forward-char 1) |
2948 (set (make-local-variable 'calendar-starred-day) | 2412 (setq calendar-starred-day |
2949 (string-to-number | 2413 (string-to-number (buffer-substring (point) (- (point) 2)))) |
2950 (buffer-substring (point) (- (point) 2)))) | |
2951 ;; Insert before deleting, to better preserve markers. | 2414 ;; Insert before deleting, to better preserve markers. |
2952 (insert "**") | 2415 (insert "**") |
2953 (forward-char -2) | 2416 (forward-char -2) |
2954 (delete-char -2) | 2417 (delete-char -2) |
2955 (forward-char 1) | 2418 (forward-char 1) |