diff options
| author | Glenn Morris | 2003-08-03 13:59:13 +0000 |
|---|---|---|
| committer | Glenn Morris | 2003-08-03 13:59:13 +0000 |
| commit | 2c8811d49bb3ee361884630438d13c660f1c12e5 (patch) | |
| tree | 4721e7053b44bfbbdb967b19e51242004ab30f4a | |
| parent | 30f5dd988bc0e40670d41e573a04075267995a31 (diff) | |
| download | emacs-2c8811d49bb3ee361884630438d13c660f1c12e5.tar.gz emacs-2c8811d49bb3ee361884630438d13c660f1c12e5.zip | |
(diary-file, diary-file-name-prefix)
(european-calendar-style, diary-date-forms)
(calendar-day-name-array, calendar-month-name-array): Doc change.
(generate-calendar-month): Adapt for new behaviour of
`calendar-day-name' function.
(calendar-abbrev-length, calendar-day-abbrev-array)
(calendar-month-abbrev-array): New variables.
(calendar-abbrev-construct): New function.
(calendar-day-name, calendar-month-name): Use new abbrev arrays,
rather than fixing abbrevs at some width. Calling syntax change.
(calendar-make-alist): Use abbrev arrays. Calling syntax change.
(calendar-date-string): Adapt for new behaviours of
`calendar-day-name' and `calendar-month-name' functions.
| -rw-r--r-- | lisp/calendar/calendar.el | 267 |
1 files changed, 174 insertions, 93 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index bd86f273b28..88d389072c2 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; calendar.el --- calendar functions | 1 | ;;; calendar.el --- calendar functions |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, | 3 | ;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, |
| 4 | ;; 2000, 2001 Free Software Foundation, Inc. | 4 | ;; 2000, 2001, 2003 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> | 6 | ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu> |
| 7 | ;; Keywords: calendar | 7 | ;; Keywords: calendar |
| @@ -381,7 +381,8 @@ redisplays the diary for whatever date the cursor is moved to." | |||
| 381 | (defcustom diary-file "~/diary" | 381 | (defcustom diary-file "~/diary" |
| 382 | "*Name of the file in which one's personal diary of dates is kept. | 382 | "*Name of the file in which one's personal diary of dates is kept. |
| 383 | 383 | ||
| 384 | The file's entries are lines in any of the forms | 384 | The file's entries are lines beginning with any of the forms |
| 385 | specified by the variable `american-date-diary-pattern', by default: | ||
| 385 | 386 | ||
| 386 | MONTH/DAY | 387 | MONTH/DAY |
| 387 | MONTH/DAY/YEAR | 388 | MONTH/DAY/YEAR |
| @@ -389,19 +390,24 @@ The file's entries are lines in any of the forms | |||
| 389 | MONTHNAME DAY, YEAR | 390 | MONTHNAME DAY, YEAR |
| 390 | DAYNAME | 391 | DAYNAME |
| 391 | 392 | ||
| 392 | at the beginning of the line; the remainder of the line is the diary entry | 393 | with the remainder of the line being the diary entry string for |
| 393 | string for that date. MONTH and DAY are one or two digit numbers, YEAR is | 394 | that date. MONTH and DAY are one or two digit numbers, YEAR is a |
| 394 | a number and may be written in full or abbreviated to the final two digits. | 395 | number and may be written in full or abbreviated to the final two |
| 395 | If the date does not contain a year, it is generic and applies to any year. | 396 | digits (if `abbreviated-calendar-year' is non-nil). MONTHNAME |
| 396 | DAYNAME entries apply to any date on which is on that day of the week. | 397 | and DAYNAME can be spelled in full (as specified by the variables |
| 397 | MONTHNAME and DAYNAME can be spelled in full, abbreviated to three | 398 | `calendar-month-name-array' and `calendar-day-name-array'), |
| 398 | characters (with or without a period), capitalized or not. Any of DAY, | 399 | abbreviated (as specified by `calendar-month-abbrev-array' and |
| 399 | MONTH, or MONTHNAME, YEAR can be `*' which matches any day, month, or year, | 400 | `calendar-day-abbrev-array') with or without a period, |
| 400 | respectively. | 401 | capitalized or not. Any of DAY, MONTH, or MONTHNAME, YEAR can be |
| 401 | 402 | `*' which matches any day, month, or year, respectively. If the | |
| 402 | The European style (in which the day precedes the month) can be used | 403 | date does not contain a year, it is generic and applies to any |
| 403 | instead, if you execute `european-calendar' when in the calendar, or set | 404 | year. A DAYNAME entry applies to the appropriate day of the week |
| 404 | `european-calendar-style' to t in your .emacs file. The European forms are | 405 | in every week. |
| 406 | |||
| 407 | The European style (in which the day precedes the month) can be | ||
| 408 | used instead, if you execute `european-calendar' when in the | ||
| 409 | calendar, or set `european-calendar-style' to t in your .emacs | ||
| 410 | file. The European forms (see `european-date-diary-pattern') are | ||
| 405 | 411 | ||
| 406 | DAY/MONTH | 412 | DAY/MONTH |
| 407 | DAY/MONTH/YEAR | 413 | DAY/MONTH/YEAR |
| @@ -507,28 +513,33 @@ See the documentation for the function `include-other-diary-files'." | |||
| 507 | :type 'regexp | 513 | :type 'regexp |
| 508 | :group 'diary) | 514 | :group 'diary) |
| 509 | 515 | ||
| 510 | (defcustom diary-face-attrs '( | 516 | (defcustom diary-face-attrs |
| 511 | (" *\\[foreground:\\([-a-z]+\\)\\]$" 1 :foreground string) | 517 | '((" *\\[foreground:\\([-a-z]+\\)\\]$" 1 :foreground string) |
| 512 | (" *\\[background:\\([-a-z]+\\)\\]$" 1 :background string) | 518 | (" *\\[background:\\([-a-z]+\\)\\]$" 1 :background string) |
| 513 | (" *\\[width:\\([-a-z]+\\)\\]$" 1 :width symbol) | 519 | (" *\\[width:\\([-a-z]+\\)\\]$" 1 :width symbol) |
| 514 | (" *\\[height:\\([-0-9a-z]+\\)\\]$" 1 :height int) | 520 | (" *\\[height:\\([-0-9a-z]+\\)\\]$" 1 :height int) |
| 515 | (" *\\[weight:\\([-a-z]+\\)\\]$" 1 :weight symbol) | 521 | (" *\\[weight:\\([-a-z]+\\)\\]$" 1 :weight symbol) |
| 516 | (" *\\[slant:\\([-a-z]+\\)\\]$" 1 :slant symbol) | 522 | (" *\\[slant:\\([-a-z]+\\)\\]$" 1 :slant symbol) |
| 517 | (" *\\[underline:\\([-a-z]+\\)\\]$" 1 :underline stringtnil) | 523 | (" *\\[underline:\\([-a-z]+\\)\\]$" 1 :underline stringtnil) |
| 518 | (" *\\[overline:\\([-a-z]+\\)\\]$" 1 :overline stringtnil) | 524 | (" *\\[overline:\\([-a-z]+\\)\\]$" 1 :overline stringtnil) |
| 519 | (" *\\[strike-through:\\([-a-z]+\\)\\]$" 1 :strike-through stringtnil) | 525 | (" *\\[strike-through:\\([-a-z]+\\)\\]$" 1 :strike-through stringtnil) |
| 520 | (" *\\[inverse-video:\\([-a-z]+\\)\\]$" 1 :inverse-video tnil) | 526 | (" *\\[inverse-video:\\([-a-z]+\\)\\]$" 1 :inverse-video tnil) |
| 521 | (" *\\[face:\\([-0-9a-z]+\\)\\]$" 1 :face string) | 527 | (" *\\[face:\\([-0-9a-z]+\\)\\]$" 1 :face string) |
| 522 | (" *\\[font:\\([-a-z0-9]+\\)\\]$" 1 :font string) | 528 | (" *\\[font:\\([-a-z0-9]+\\)\\]$" 1 :font string) |
| 523 | ;Unsupported (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box) | 529 | ;; Unsupported. |
| 524 | ;Unsupported (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple) | 530 | ;;; (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box) |
| 525 | ) | 531 | ;;; (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple) |
| 526 | "*A list of (regexp regnum attr attrtype) lists where the regexp says how to find the tag, the regnum says which parenthetical sub-regexp this regexp looks for, and the attr says which attribute of the face (or that this _is_ a face) is being modified." | 532 | ) |
| 533 | "*A list of (regexp regnum attr attrtype) lists where the | ||
| 534 | regexp says how to find the tag, the regnum says which | ||
| 535 | parenthetical sub-regexp this regexp looks for, and the attr says | ||
| 536 | which attribute of the face (or that this _is_ a face) is being | ||
| 537 | modified." | ||
| 527 | :type 'sexp | 538 | :type 'sexp |
| 528 | :group 'diary) | 539 | :group 'diary) |
| 529 | 540 | ||
| 530 | (defcustom diary-file-name-prefix nil | 541 | (defcustom diary-file-name-prefix nil |
| 531 | "If non-nil then each entry in the diary list will be prefixed with the name of the file in which it was defined." | 542 | "If non-nil each diary entry is prefixed with the name of the file where it is defined." |
| 532 | :type 'boolean | 543 | :type 'boolean |
| 533 | :group 'diary) | 544 | :group 'diary) |
| 534 | 545 | ||
| @@ -551,7 +562,8 @@ If this variable is nil, years must be written in full." | |||
| 551 | (defcustom european-calendar-style nil | 562 | (defcustom european-calendar-style nil |
| 552 | "*Use the European style of dates in the diary and in any displays. | 563 | "*Use the European style of dates in the diary and in any displays. |
| 553 | If this variable is t, a date 1/2/1990 would be interpreted as February 1, | 564 | If this variable is t, a date 1/2/1990 would be interpreted as February 1, |
| 554 | 1990. The accepted European date styles are | 565 | 1990. The default European date styles (see `european-date-diary-pattern') |
| 566 | are | ||
| 555 | 567 | ||
| 556 | DAY/MONTH | 568 | DAY/MONTH |
| 557 | DAY/MONTH/YEAR | 569 | DAY/MONTH/YEAR |
| @@ -559,8 +571,9 @@ If this variable is t, a date 1/2/1990 would be interpreted as February 1, | |||
| 559 | DAY MONTHNAME YEAR | 571 | DAY MONTHNAME YEAR |
| 560 | DAYNAME | 572 | DAYNAME |
| 561 | 573 | ||
| 562 | Names can be capitalized or not, written in full, or abbreviated to three | 574 | Names can be capitalized or not, written in full (as specified by the |
| 563 | characters with or without a period." | 575 | variable `calendar-day-name-array'), or abbreviated (as specified by |
| 576 | `calendar-day-abbrev-array') with or without a period." | ||
| 564 | :type 'boolean | 577 | :type 'boolean |
| 565 | :group 'diary) | 578 | :group 'diary) |
| 566 | 579 | ||
| @@ -614,12 +627,14 @@ any portion of the diary entry itself, just the date component. | |||
| 614 | 627 | ||
| 615 | A pseudo-pattern is a list of regular expressions and the keywords `month', | 628 | A pseudo-pattern is a list of regular expressions and the keywords `month', |
| 616 | `day', `year', `monthname', and `dayname'. The keyword `monthname' will | 629 | `day', `year', `monthname', and `dayname'. The keyword `monthname' will |
| 617 | match the name of the month, capitalized or not, or its three-letter | 630 | match the name of the month (see `calendar-month-name-array'), capitalized |
| 618 | abbreviation, followed by a period or not; it will also match `*'. | 631 | or not, or its user-specified abbreviation (see `calendar-month-abbrev-array'), |
| 619 | Similarly, `dayname' will match the name of the day, capitalized or not, or | 632 | followed by a period or not; it will also match `*'. Similarly, `dayname' |
| 620 | its three-letter abbreviation, followed by a period or not. The keywords | 633 | will match the name of the day (see `calendar-day-name-array'), capitalized or |
| 621 | `month', `day', and `year' will match those numerical values, preceded by | 634 | not, or its user-specified abbreviation (see `calendar-day-abbrev-array'), |
| 622 | arbitrarily many zeros; they will also match `*'. | 635 | followed by a period or not. The keywords `month', `day', and `year' will |
| 636 | match those numerical values, preceded by arbitrarily many zeros; they will | ||
| 637 | also match `*'. | ||
| 623 | 638 | ||
| 624 | The matching of the diary entries with the date forms is done with the | 639 | The matching of the diary entries with the date forms is done with the |
| 625 | standard syntax table from Fundamental mode, but with the `*' changed so | 640 | standard syntax table from Fundamental mode, but with the `*' changed so |
| @@ -1893,10 +1908,15 @@ line." | |||
| 1893 | (list (format "%s %d" (calendar-month-name month) year)) ? 20) | 1908 | (list (format "%s %d" (calendar-month-name month) year)) ? 20) |
| 1894 | indent t) | 1909 | indent t) |
| 1895 | (calendar-insert-indented "" indent);; Go to proper spot | 1910 | (calendar-insert-indented "" indent);; Go to proper spot |
| 1911 | ;; Use the first two characters of each day to head the columns. | ||
| 1896 | (calendar-for-loop i from 0 to 6 do | 1912 | (calendar-for-loop i from 0 to 6 do |
| 1897 | (insert (calendar-day-name (mod (+ calendar-week-start-day i) 7) | 1913 | (insert |
| 1898 | 2 t)) | 1914 | (let ((string |
| 1899 | (insert " ")) | 1915 | (calendar-day-name (mod (+ calendar-week-start-day i) 7) nil t))) |
| 1916 | (if enable-multibyte-characters | ||
| 1917 | (truncate-string-to-width string 2) | ||
| 1918 | (substring string 0 2))) | ||
| 1919 | " ")) | ||
| 1900 | (calendar-insert-indented "" 0 t);; Force onto following line | 1920 | (calendar-insert-indented "" 0 t);; Force onto following line |
| 1901 | (calendar-insert-indented "" indent);; Go to proper spot | 1921 | (calendar-insert-indented "" indent);; Go to proper spot |
| 1902 | ;; Add blank days before the first of the month | 1922 | ;; Add blank days before the first of the month |
| @@ -2497,14 +2517,60 @@ If optional NODAY is t, does not ask for day, but just returns | |||
| 2497 | (+ (* 12 (- yr2 yr1)) | 2517 | (+ (* 12 (- yr2 yr1)) |
| 2498 | (- mon2 mon1))) | 2518 | (- mon2 mon1))) |
| 2499 | 2519 | ||
| 2520 | (defvar calendar-abbrev-length 3 | ||
| 2521 | "*Length of abbreviations to be used for day and month names. | ||
| 2522 | See also `calendar-day-abbrev-array' and `calendar-month-abbrev-array'.") | ||
| 2523 | |||
| 2500 | (defvar calendar-day-name-array | 2524 | (defvar calendar-day-name-array |
| 2501 | ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] | 2525 | ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] |
| 2502 | "Array of capitalized strings giving, in order, the day names.") | 2526 | "*Array of capitalized strings giving, in order, the day names. |
| 2527 | The first two characters of each string will be used to head the | ||
| 2528 | day columns in the calendar. See also the variable | ||
| 2529 | `calendar-day-abbrev-array'.") | ||
| 2530 | |||
| 2531 | (defvar calendar-day-abbrev-array | ||
| 2532 | [nil nil nil nil nil nil nil] | ||
| 2533 | "*Array of capitalized strings giving the abbreviated day names. | ||
| 2534 | The order should be the same as that of the full names specified | ||
| 2535 | in `calendar-day-name-array'. These abbreviations may be used | ||
| 2536 | instead of the full names in the diary file. Do not include a | ||
| 2537 | trailing `.' in the strings specified in this variable, though | ||
| 2538 | you may use such in the diary file. If any element of this array | ||
| 2539 | is nil, then the abbreviation will be constructed as the first | ||
| 2540 | `calendar-abbrev-length' characters of the corresponding full name.") | ||
| 2503 | 2541 | ||
| 2504 | (defvar calendar-month-name-array | 2542 | (defvar calendar-month-name-array |
| 2505 | ["January" "February" "March" "April" "May" "June" | 2543 | ["January" "February" "March" "April" "May" "June" |
| 2506 | "July" "August" "September" "October" "November" "December"] | 2544 | "July" "August" "September" "October" "November" "December"] |
| 2507 | "Array of capitalized strings giving, in order, the month names.") | 2545 | "*Array of capitalized strings giving, in order, the month names. |
| 2546 | See also the variable `calendar-month-abbrev-array'.") | ||
| 2547 | |||
| 2548 | (defvar calendar-month-abbrev-array | ||
| 2549 | [nil nil nil nil nil nil nil nil nil nil nil nil] | ||
| 2550 | "*Array of capitalized strings giving the abbreviated month names. | ||
| 2551 | The order should be the same as that of the full names specified | ||
| 2552 | in `calendar-month-name-array'. These abbreviations are used in | ||
| 2553 | the calendar menu entries, and can also be used in the diary | ||
| 2554 | file. Do not include a trailing `.' in the strings specified in | ||
| 2555 | this variable, though you may use such in the diary file. If any | ||
| 2556 | element of this array is nil, then the abbreviation will be | ||
| 2557 | constructed as the first `calendar-abbrev-length' characters of the | ||
| 2558 | corresponding full name.") | ||
| 2559 | |||
| 2560 | (defun calendar-abbrev-construct (abbrev full &optional period) | ||
| 2561 | "Internal calendar function to return a complete abbreviation array. | ||
| 2562 | ABBREV is an array of abbreviations, FULL the corresponding array | ||
| 2563 | of full names. The return value is the ABBREV array, with any nil | ||
| 2564 | elements replaced by the first three characters taken from the | ||
| 2565 | corresponding element of FULL. If optional argument PERIOD is non-nil, | ||
| 2566 | each element returned has a final `.' character." | ||
| 2567 | (let (elem array) | ||
| 2568 | (dotimes (i (length full)) | ||
| 2569 | (setq elem (or (aref abbrev i) | ||
| 2570 | (substring (aref full i) 0 calendar-abbrev-length)) | ||
| 2571 | elem (format "%s%s" elem (if period "." "")) | ||
| 2572 | array (append array (list elem)))) | ||
| 2573 | (vconcat array))) | ||
| 2508 | 2574 | ||
| 2509 | (defvar calendar-font-lock-keywords | 2575 | (defvar calendar-font-lock-keywords |
| 2510 | `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) | 2576 | `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) |
| @@ -2515,46 +2581,65 @@ If optional NODAY is t, does not ask for day, but just returns | |||
| 2515 | (substring (aref calendar-day-name-array 0) 0 2))) | 2581 | (substring (aref calendar-day-name-array 0) 0 2))) |
| 2516 | ;; Saturdays and Sundays are hilited differently. | 2582 | ;; Saturdays and Sundays are hilited differently. |
| 2517 | . font-lock-comment-face) | 2583 | . font-lock-comment-face) |
| 2584 | ;; First two chars of each day are used in the calendar. | ||
| 2518 | (,(regexp-opt (mapcar (lambda (x) (substring x 0 2)) calendar-day-name-array)) | 2585 | (,(regexp-opt (mapcar (lambda (x) (substring x 0 2)) calendar-day-name-array)) |
| 2519 | . font-lock-reference-face)) | 2586 | . font-lock-reference-face)) |
| 2520 | "Default keywords to highlight in Calendar mode.") | 2587 | "Default keywords to highlight in Calendar mode.") |
| 2521 | 2588 | ||
| 2522 | (defun calendar-day-name (date &optional width absolute) | 2589 | (defun calendar-day-name (date &optional abbrev absolute) |
| 2523 | "Return a string with the name of the day of the week of DATE. | 2590 | "Return a string with the name of the day of the week of DATE. |
| 2524 | If WIDTH is non-nil, return just the first WIDTH characters of the name. | 2591 | DATE should be a list in the format (MONTH DAY YEAR), unless the |
| 2525 | If ABSOLUTE is non-nil, then DATE is actually the day-of-the-week | 2592 | optional argument ABSOLUTE is non-nil, in which case DATE should |
| 2526 | rather than a date." | 2593 | be an integer in the range 0 to 6 corresponding to the day of the |
| 2527 | (let ((string (aref calendar-day-name-array | 2594 | week. Day names are taken from the variable `calendar-day-name-array', |
| 2528 | (if absolute date (calendar-day-of-week date))))) | 2595 | unless the optional argument ABBREV is non-nil, in which case |
| 2529 | (cond ((null width) string) | 2596 | the variable `calendar-day-abbrev-array' is used." |
| 2530 | (enable-multibyte-characters (truncate-string-to-width string width)) | 2597 | (aref (if abbrev |
| 2531 | (t (substring string 0 width))))) | 2598 | (calendar-abbrev-construct calendar-day-abbrev-array |
| 2532 | 2599 | calendar-day-name-array) | |
| 2533 | (defun calendar-make-alist (sequence &optional start-index filter) | 2600 | calendar-day-name-array) |
| 2601 | (if absolute date (calendar-day-of-week date)))) | ||
| 2602 | |||
| 2603 | (defun calendar-make-alist (sequence &optional start-index filter abbrevs) | ||
| 2534 | "Make an assoc list corresponding to SEQUENCE. | 2604 | "Make an assoc list corresponding to SEQUENCE. |
| 2535 | Start at index 1, unless optional START-INDEX is provided. | 2605 | Each element of sequence will be associated with an integer, starting |
| 2536 | If FILTER is provided, apply it to each item in the list." | 2606 | from 1, or from START-INDEX if that is non-nil. If a sequence ABBREVS |
| 2537 | (let ((index (if start-index (1- start-index) 0))) | 2607 | is supplied, the function `calendar-abbrev-construct' is used to |
| 2538 | (mapcar | 2608 | construct abbreviations corresponding to the elements in SEQUENCE. |
| 2539 | (lambda (x) | 2609 | Each abbreviation is entered into the alist with the same |
| 2540 | (setq index (1+ index)) | 2610 | association index as the full name it represents. |
| 2541 | (cons (if filter (funcall filter x) x) | 2611 | If FILTER is provided, apply it to each key in the alist." |
| 2542 | index)) | 2612 | (let ((index 0) |
| 2543 | (append sequence nil)))) | 2613 | (offset (or start-index 1)) |
| 2544 | 2614 | (aseq (if abbrevs (calendar-abbrev-construct abbrevs sequence))) | |
| 2545 | (defun calendar-month-name (month &optional width) | 2615 | (aseqp (if abbrevs (calendar-abbrev-construct abbrevs sequence |
| 2546 | "The name of MONTH. | 2616 | 'period))) |
| 2547 | If WIDTH is non-nil, return just the first WIDTH characters of the name." | 2617 | alist elem) |
| 2548 | (let ((string (aref calendar-month-name-array (1- month)))) | 2618 | (dotimes (i (1- (length sequence)) (reverse alist)) |
| 2549 | (if width | 2619 | (setq index (+ i offset) |
| 2550 | (let ((i 0) (result "") (pos 0)) | 2620 | elem (elt sequence i) |
| 2551 | (while (< i width) | 2621 | alist |
| 2552 | (let ((chartext (char-to-string (aref string pos)))) | 2622 | (cons (cons (if filter (funcall filter elem) elem) index) alist)) |
| 2553 | (setq pos (+ pos (length chartext))) | 2623 | (if aseq |
| 2554 | (setq result (concat result chartext))) | 2624 | (setq elem (elt aseq i) |
| 2555 | (setq i (1+ i))) | 2625 | alist (cons (cons (if filter (funcall filter elem) elem) |
| 2556 | result) | 2626 | index) alist))) |
| 2557 | string))) | 2627 | (if aseqp |
| 2628 | (setq elem (elt aseqp i) | ||
| 2629 | alist (cons (cons (if filter (funcall filter elem) elem) | ||
| 2630 | index) alist)))))) | ||
| 2631 | |||
| 2632 | (defun calendar-month-name (month &optional abbrev) | ||
| 2633 | "Return a string with the name of month number MONTH. | ||
| 2634 | Months are numbered from one. Month names are taken from the | ||
| 2635 | variable `calendar-month-name-array', unless the optional | ||
| 2636 | argument ABBREV is non-nil, in which case | ||
| 2637 | `calendar-month-abbrev-array' is used." | ||
| 2638 | (aref (if abbrev | ||
| 2639 | (calendar-abbrev-construct calendar-month-abbrev-array | ||
| 2640 | calendar-month-name-array) | ||
| 2641 | calendar-month-name-array) | ||
| 2642 | (1- month))) | ||
| 2558 | 2643 | ||
| 2559 | (defun calendar-day-of-week (date) | 2644 | (defun calendar-day-of-week (date) |
| 2560 | "Return the day-of-the-week index of DATE, 0 for Sunday, 1 for Monday, etc." | 2645 | "Return the day-of-the-week index of DATE, 0 for Sunday, 1 for Monday, etc." |
| @@ -2665,20 +2750,16 @@ The actual dates are in the car of DATE1 and DATE2." | |||
| 2665 | 2750 | ||
| 2666 | (defun calendar-date-string (date &optional abbreviate nodayname) | 2751 | (defun calendar-date-string (date &optional abbreviate nodayname) |
| 2667 | "A string form of DATE, driven by the variable `calendar-date-display-form'. | 2752 | "A string form of DATE, driven by the variable `calendar-date-display-form'. |
| 2668 | An optional parameter ABBREVIATE, when t, causes the month and day names to be | 2753 | An optional parameter ABBREVIATE, when non-nil, causes the month |
| 2669 | abbreviated to three characters. An optional parameter NODAYNAME, when t, | 2754 | and day names to be abbreviated as specified by |
| 2670 | omits the name of the day of the week." | 2755 | `calendar-month-abbrev-array' and `calendar-day-abbrev-array', |
| 2756 | respectively. An optional parameter NODAYNAME, when t, omits the | ||
| 2757 | name of the day of the week." | ||
| 2671 | (let* ((dayname | 2758 | (let* ((dayname |
| 2672 | (if nodayname | 2759 | (unless nodayname |
| 2673 | nil | 2760 | (calendar-day-name date abbreviate))) |
| 2674 | (if abbreviate | ||
| 2675 | (calendar-day-name date 3) | ||
| 2676 | (calendar-day-name date)))) | ||
| 2677 | (month (extract-calendar-month date)) | 2761 | (month (extract-calendar-month date)) |
| 2678 | (monthname | 2762 | (monthname (calendar-month-name month abbreviate)) |
| 2679 | (if abbreviate | ||
| 2680 | (calendar-month-name month 3) | ||
| 2681 | (calendar-month-name month))) | ||
| 2682 | (day (int-to-string (extract-calendar-day date))) | 2763 | (day (int-to-string (extract-calendar-day date))) |
| 2683 | (month (int-to-string month)) | 2764 | (month (int-to-string month)) |
| 2684 | (year (int-to-string (extract-calendar-year date)))) | 2765 | (year (int-to-string (extract-calendar-year date)))) |