Mercurial > emacs
comparison lisp/calendar/cal-bahai.el @ 92578:8b2b620788b7
Unquote lambda functions. Add autoload cookies to functions formerly
autoloaded in calendar.el. Set `generated-autoload-file' to
"cal-loaddefs.el".
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 08 Mar 2008 03:39:08 +0000 |
parents | 107ccd98fa12 |
children | 3dd341aae76d |
comparison
equal
deleted
inserted
replaced
92577:2d599418bddb | 92578:8b2b620788b7 |
---|---|
1 ;;; cal-bahai.el --- calendar functions for the Bahá'í calendar. -*- coding: utf-8 -*- | 1 ;;; cal-bahai.el --- calendar functions for the Bahá'í calendar. |
2 | 2 |
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 | 3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
4 ;; Free Software Foundation, Inc. | 4 ;; Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: John Wiegley <johnw@gnu.org> | 6 ;; Author: John Wiegley <johnw@gnu.org> |
116 (day ;; Calculate the day by subtraction. | 116 (day ;; Calculate the day by subtraction. |
117 (- date | 117 (- date |
118 (1- (calendar-absolute-from-bahai (list month 1 year)))))) | 118 (1- (calendar-absolute-from-bahai (list month 1 year)))))) |
119 (list month day year)))) | 119 (list month day year)))) |
120 | 120 |
121 ;;;###autoload | |
121 (defun calendar-bahai-date-string (&optional date) | 122 (defun calendar-bahai-date-string (&optional date) |
122 "String of Bahá'í date of Gregorian DATE. | 123 "String of Bahá'í date of Gregorian DATE. |
123 Defaults to today's date if DATE is not given." | 124 Defaults to today's date if DATE is not given." |
124 (let* ((bahai-date (calendar-bahai-from-absolute | 125 (let* ((bahai-date (calendar-bahai-from-absolute |
125 (calendar-absolute-from-gregorian | 126 (calendar-absolute-from-gregorian |
141 (dayname nil) | 142 (dayname nil) |
142 (month (int-to-string m)) | 143 (month (int-to-string m)) |
143 (year (int-to-string y))) | 144 (year (int-to-string y))) |
144 (mapconcat 'eval calendar-date-display-form "")))) | 145 (mapconcat 'eval calendar-date-display-form "")))) |
145 | 146 |
147 ;;;###autoload | |
146 (defun calendar-bahai-print-date () | 148 (defun calendar-bahai-print-date () |
147 "Show the Bahá'í calendar equivalent of the selected date." | 149 "Show the Bahá'í calendar equivalent of the selected date." |
148 (interactive) | 150 (interactive) |
149 (message "Bahá'í date: %s" | 151 (message "Bahá'í date: %s" |
150 (calendar-bahai-date-string (calendar-cursor-to-date t)))) | 152 (calendar-bahai-date-string (calendar-cursor-to-date t)))) |
151 | 153 |
154 ;;;###autoload | |
152 (defun calendar-bahai-goto-date (date &optional noecho) | 155 (defun calendar-bahai-goto-date (date &optional noecho) |
153 "Move cursor to Bahá'í date DATE. | 156 "Move cursor to Bahá'í date DATE. |
154 Echo Bahá'í date unless NOECHO is t." | 157 Echo Bahá'í date unless NOECHO is t." |
155 (interactive (calendar-bahai-prompt-for-date)) | 158 (interactive (calendar-bahai-prompt-for-date)) |
156 (calendar-goto-date (calendar-gregorian-from-absolute | 159 (calendar-goto-date (calendar-gregorian-from-absolute |
160 (defun calendar-bahai-prompt-for-date () | 163 (defun calendar-bahai-prompt-for-date () |
161 "Ask for a Bahá'í date." | 164 "Ask for a Bahá'í date." |
162 (let* ((today (calendar-current-date)) | 165 (let* ((today (calendar-current-date)) |
163 (year (calendar-read | 166 (year (calendar-read |
164 "Bahá'í calendar year (not 0): " | 167 "Bahá'í calendar year (not 0): " |
165 '(lambda (x) (/= x 0)) | 168 (lambda (x) (/= x 0)) |
166 (int-to-string | 169 (int-to-string |
167 (extract-calendar-year | 170 (extract-calendar-year |
168 (calendar-bahai-from-absolute | 171 (calendar-bahai-from-absolute |
169 (calendar-absolute-from-gregorian today)))))) | 172 (calendar-absolute-from-gregorian today)))))) |
170 (completion-ignore-case t) | 173 (completion-ignore-case t) |
175 (append calendar-bahai-month-name-array nil)) | 178 (append calendar-bahai-month-name-array nil)) |
176 nil t) | 179 nil t) |
177 (calendar-make-alist calendar-bahai-month-name-array | 180 (calendar-make-alist calendar-bahai-month-name-array |
178 1)))) | 181 1)))) |
179 (day (calendar-read "Bahá'í calendar day (1-19): " | 182 (day (calendar-read "Bahá'í calendar day (1-19): " |
180 '(lambda (x) (and (< 0 x) (<= x 19)))))) | 183 (lambda (x) (and (< 0 x) (<= x 19)))))) |
181 (list (list month day year)))) | 184 (list (list month day year)))) |
182 | 185 |
183 (defun diary-bahai-date () | 186 (defun diary-bahai-date () |
184 "Bahá'í calendar equivalent of date diary entry." | 187 "Bahá'í calendar equivalent of date diary entry." |
185 (format "Bahá'í date: %s" (calendar-bahai-date-string date))) | 188 (format "Bahá'í date: %s" (calendar-bahai-date-string date))) |
394 (mark-calendar-days-named | 397 (mark-calendar-days-named |
395 (cdr (assoc-string (substring dd-name 0 3) | 398 (cdr (assoc-string (substring dd-name 0 3) |
396 (calendar-make-alist | 399 (calendar-make-alist |
397 calendar-day-name-array | 400 calendar-day-name-array |
398 0 | 401 0 |
399 '(lambda (x) (substring x 0 3))) | 402 (lambda (x) (substring x 0 3))) |
400 t))) | 403 t))) |
401 (if mm-name | 404 (if mm-name |
402 (if (string-equal mm-name "*") | 405 (if (string-equal mm-name "*") |
403 (setq mm 0) | 406 (setq mm 0) |
404 (setq mm | 407 (setq mm |
466 (or (zerop year) | 469 (or (zerop year) |
467 (= year i-year)) | 470 (= year i-year)) |
468 (mark-visible-calendar-date | 471 (mark-visible-calendar-date |
469 (calendar-gregorian-from-absolute date))))))))) | 472 (calendar-gregorian-from-absolute date))))))))) |
470 | 473 |
474 ;;;###autoload | |
471 (defun diary-bahai-insert-entry (arg) | 475 (defun diary-bahai-insert-entry (arg) |
472 "Insert a diary entry. | 476 "Insert a diary entry. |
473 For the Bahá'í date corresponding to the date indicated by point. | 477 For the Bahá'í date corresponding to the date indicated by point. |
474 Prefix arg will make the entry nonmarking." | 478 Prefix arg will make the entry nonmarking." |
475 (interactive "P") | 479 (interactive "P") |
482 (calendar-absolute-from-gregorian | 486 (calendar-absolute-from-gregorian |
483 (calendar-cursor-to-date t))) | 487 (calendar-cursor-to-date t))) |
484 nil t)) | 488 nil t)) |
485 arg))) | 489 arg))) |
486 | 490 |
491 ;;;###autoload | |
487 (defun diary-bahai-insert-monthly-entry (arg) | 492 (defun diary-bahai-insert-monthly-entry (arg) |
488 "Insert a monthly diary entry. | 493 "Insert a monthly diary entry. |
489 For the day of the Bahá'í month corresponding to the date indicated by point. | 494 For the day of the Bahá'í month corresponding to the date indicated by point. |
490 Prefix arg will make the entry nonmarking." | 495 Prefix arg will make the entry nonmarking." |
491 (interactive "P") | 496 (interactive "P") |
499 (calendar-bahai-from-absolute | 504 (calendar-bahai-from-absolute |
500 (calendar-absolute-from-gregorian | 505 (calendar-absolute-from-gregorian |
501 (calendar-cursor-to-date t))))) | 506 (calendar-cursor-to-date t))))) |
502 arg))) | 507 arg))) |
503 | 508 |
509 ;;;###autoload | |
504 (defun diary-bahai-insert-yearly-entry (arg) | 510 (defun diary-bahai-insert-yearly-entry (arg) |
505 "Insert an annual diary entry. | 511 "Insert an annual diary entry. |
506 For the day of the Bahá'í year corresponding to the date indicated by point. | 512 For the day of the Bahá'í year corresponding to the date indicated by point. |
507 Prefix arg will make the entry nonmarking." | 513 Prefix arg will make the entry nonmarking." |
508 (interactive "P") | 514 (interactive "P") |
538 (define-obsolete-function-alias | 544 (define-obsolete-function-alias |
539 'calendar-print-bahai-date 'calendar-bahai-print-date "23.1") | 545 'calendar-print-bahai-date 'calendar-bahai-print-date "23.1") |
540 | 546 |
541 (provide 'cal-bahai) | 547 (provide 'cal-bahai) |
542 | 548 |
549 ;; Local Variables: | |
550 ;; coding: utf-8 | |
551 ;; generated-autoload-file: "cal-loaddefs.el" | |
552 ;; End: | |
553 | |
543 ;; arch-tag: c1cb1d67-862a-4264-a01c-41cb4df01f14 | 554 ;; arch-tag: c1cb1d67-862a-4264-a01c-41cb4df01f14 |
544 ;;; cal-bahai.el ends here | 555 ;;; cal-bahai.el ends here |