diff options
| author | Glenn Morris | 2008-03-20 04:41:47 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-03-20 04:41:47 +0000 |
| commit | 5968ae93e21600da080be7fd7ac21002e1e4ebde (patch) | |
| tree | b46d41125457bad11eae9aa2e1fdcece0ed705de | |
| parent | a8774f05b2dde025df92369667f157c0c46899be (diff) | |
| download | emacs-5968ae93e21600da080be7fd7ac21002e1e4ebde.tar.gz emacs-5968ae93e21600da080be7fd7ac21002e1e4ebde.zip | |
(calendar-other-dates): New function.
(calendar-print-other-dates): Use calendar-other-dates.
| -rw-r--r-- | lisp/calendar/calendar.el | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index c5a1d372e23..6b3388bf74a 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -2444,54 +2444,57 @@ Defaults to today's date if DATE is not given." | |||
| 2444 | (format "Day %d of %d; %d day%s remaining in the year" | 2444 | (format "Day %d of %d; %d day%s remaining in the year" |
| 2445 | day year days-remaining (if (= days-remaining 1) "" "s")))) | 2445 | day year days-remaining (if (= days-remaining 1) "" "s")))) |
| 2446 | 2446 | ||
| 2447 | (defun calendar-other-dates (date) | ||
| 2448 | "Return a list of strings giving Gregorian DATE in other calendars. | ||
| 2449 | DATE is (month day year). Calendars that do not apply are omitted." | ||
| 2450 | (let (odate) | ||
| 2451 | (delq nil | ||
| 2452 | (list | ||
| 2453 | (calendar-day-of-year-string date) | ||
| 2454 | (format "ISO date: %s" (calendar-iso-date-string date)) | ||
| 2455 | (format "Julian date: %s" | ||
| 2456 | (calendar-julian-date-string date)) | ||
| 2457 | (format "Astronomical (Julian) day number (at noon UTC): %s.0" | ||
| 2458 | (calendar-astro-date-string date)) | ||
| 2459 | (format "Fixed (RD) date: %s" | ||
| 2460 | (calendar-absolute-from-gregorian date)) | ||
| 2461 | (format "Hebrew date (before sunset): %s" | ||
| 2462 | (calendar-hebrew-date-string date)) | ||
| 2463 | (format "Persian date: %s" | ||
| 2464 | (calendar-persian-date-string date)) | ||
| 2465 | (unless (string-equal | ||
| 2466 | (setq odate (calendar-islamic-date-string date)) | ||
| 2467 | "") | ||
| 2468 | (format "Islamic date (before sunset): %s" odate)) | ||
| 2469 | (unless (string-equal | ||
| 2470 | (setq odate (calendar-bahai-date-string date)) | ||
| 2471 | "") | ||
| 2472 | (format "Baha'i date: %s" odate)) | ||
| 2473 | (format "Chinese date: %s" | ||
| 2474 | (calendar-chinese-date-string date)) | ||
| 2475 | (unless (string-equal | ||
| 2476 | (setq odate (calendar-coptic-date-string date)) | ||
| 2477 | "") | ||
| 2478 | (format "Coptic date: %s" odate)) | ||
| 2479 | (unless (string-equal | ||
| 2480 | (setq odate (calendar-ethiopic-date-string date)) | ||
| 2481 | "") | ||
| 2482 | (format "Ethiopic date: %s" odate)) | ||
| 2483 | (unless (string-equal | ||
| 2484 | (setq odate (calendar-french-date-string date)) | ||
| 2485 | "") | ||
| 2486 | (format "French Revolutionary date: %s" odate)) | ||
| 2487 | (format "Mayan date: %s" | ||
| 2488 | (calendar-mayan-date-string date)))))) | ||
| 2489 | |||
| 2447 | (defun calendar-print-other-dates () | 2490 | (defun calendar-print-other-dates () |
| 2448 | "Show dates on other calendars for date under the cursor." | 2491 | "Show dates on other calendars for date under the cursor." |
| 2449 | (interactive) | 2492 | (interactive) |
| 2450 | (let ((date (calendar-cursor-to-date t)) | 2493 | (let ((date (calendar-cursor-to-date t))) |
| 2451 | odate) | ||
| 2452 | (calendar-in-read-only-buffer other-calendars-buffer | 2494 | (calendar-in-read-only-buffer other-calendars-buffer |
| 2453 | (calendar-set-mode-line (format "%s (Gregorian)" | 2495 | (calendar-set-mode-line (format "%s (Gregorian)" |
| 2454 | (calendar-date-string date))) | 2496 | (calendar-date-string date))) |
| 2455 | (apply | 2497 | (insert (mapconcat 'identity (calendar-other-dates date) "\n"))))) |
| 2456 | 'insert | ||
| 2457 | (delq nil | ||
| 2458 | (list | ||
| 2459 | (calendar-day-of-year-string date) "\n" | ||
| 2460 | (format "ISO date: %s\n" (calendar-iso-date-string date)) | ||
| 2461 | (format "Julian date: %s\n" | ||
| 2462 | (calendar-julian-date-string date)) | ||
| 2463 | (format "Astronomical (Julian) day number (at noon UTC): %s.0\n" | ||
| 2464 | (calendar-astro-date-string date)) | ||
| 2465 | (format "Fixed (RD) date: %s\n" | ||
| 2466 | (calendar-absolute-from-gregorian date)) | ||
| 2467 | (format "Hebrew date (before sunset): %s\n" | ||
| 2468 | (calendar-hebrew-date-string date)) | ||
| 2469 | (format "Persian date: %s\n" | ||
| 2470 | (calendar-persian-date-string date)) | ||
| 2471 | (unless (string-equal | ||
| 2472 | (setq odate (calendar-islamic-date-string date)) | ||
| 2473 | "") | ||
| 2474 | (format "Islamic date (before sunset): %s\n" odate)) | ||
| 2475 | (unless (string-equal | ||
| 2476 | (setq odate (calendar-bahai-date-string date)) | ||
| 2477 | "") | ||
| 2478 | (format "Baha'i date (before sunset): %s\n" odate)) | ||
| 2479 | (format "Chinese date: %s\n" | ||
| 2480 | (calendar-chinese-date-string date)) | ||
| 2481 | (unless (string-equal | ||
| 2482 | (setq odate (calendar-coptic-date-string date)) | ||
| 2483 | "") | ||
| 2484 | (format "Coptic date: %s\n" odate)) | ||
| 2485 | (unless (string-equal | ||
| 2486 | (setq odate (calendar-ethiopic-date-string date)) | ||
| 2487 | "") | ||
| 2488 | (format "Ethiopic date: %s\n" e)) | ||
| 2489 | (unless (string-equal | ||
| 2490 | (setq odate (calendar-french-date-string date)) | ||
| 2491 | "") | ||
| 2492 | (format "French Revolutionary date: %s\n" odate)) | ||
| 2493 | (format "Mayan date: %s\n" | ||
| 2494 | (calendar-mayan-date-string date)))))))) | ||
| 2495 | 2498 | ||
| 2496 | (defun calendar-print-day-of-year () | 2499 | (defun calendar-print-day-of-year () |
| 2497 | "Show day number in year/days remaining in year for date under the cursor." | 2500 | "Show day number in year/days remaining in year for date under the cursor." |