aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-03-14 06:54:36 +0000
committerGlenn Morris2008-03-14 06:54:36 +0000
commit8f11970df6e1f807641582bfa27a449e9f80ef2a (patch)
tree05367df1ac2c795ba62c23d887f3837618125088
parentcfcc468faac65a8e21abd90d62937bf3254ad491 (diff)
downloademacs-8f11970df6e1f807641582bfa27a449e9f80ef2a.tar.gz
emacs-8f11970df6e1f807641582bfa27a449e9f80ef2a.zip
(displayed-month, displayed-year, original-date): Move declarations
where needed. (calendar-goto-hebrew-date, list-hebrew-diary-entries, diary-yahrzeit): Doc fix. (list-hebrew-diary-entries, mark-hebrew-diary-entries): Move some constant variables outside the loop. Use dolist.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/calendar/cal-hebrew.el175
2 files changed, 94 insertions, 88 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 82a09876b3d..a8028c01ec5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -44,6 +44,13 @@
44 (french-calendar-day-name-array, french-calendar-special-days-array): 44 (french-calendar-day-name-array, french-calendar-special-days-array):
45 Add doc strings. 45 Add doc strings.
46 46
47 * calendar/cal-hebrew.el (displayed-month, displayed-year)
48 (original-date): Move declarations where needed.
49 (calendar-goto-hebrew-date, list-hebrew-diary-entries, diary-yahrzeit):
50 Doc fix.
51 (list-hebrew-diary-entries, mark-hebrew-diary-entries): Move some
52 constant variables outside the loop. Use dolist.
53
47 * calendar/cal-julian.el (calendar-absolute-from-julian): Move 54 * calendar/cal-julian.el (calendar-absolute-from-julian): Move
48 definition before use. Remove un-needed local `day'. 55 definition before use. Remove un-needed local `day'.
49 (calendar-goto-julian-date, calendar-goto-astro-day-number): Doc fix. 56 (calendar-goto-julian-date, calendar-goto-astro-day-number): Doc fix.
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el
index c4d2ac67f0b..3f41d9a2d2c 100644
--- a/lisp/calendar/cal-hebrew.el
+++ b/lisp/calendar/cal-hebrew.el
@@ -37,10 +37,6 @@
37 37
38;;; Code: 38;;; Code:
39 39
40(defvar displayed-month)
41(defvar displayed-year)
42(defvar original-date)
43
44(require 'calendar) 40(require 'calendar)
45 41
46(defun hebrew-calendar-leap-year-p (year) 42(defun hebrew-calendar-leap-year-p (year)
@@ -222,7 +218,7 @@ Driven by the variable `calendar-date-display-form'."
222 218
223;;;###cal-autoload 219;;;###cal-autoload
224(defun calendar-goto-hebrew-date (date &optional noecho) 220(defun calendar-goto-hebrew-date (date &optional noecho)
225 "Move cursor to Hebrew DATE; echo Hebrew date unless NOECHO is t." 221 "Move cursor to Hebrew DATE; echo Hebrew date unless NOECHO is non-nil."
226 (interactive 222 (interactive
227 (let* ((today (calendar-current-date)) 223 (let* ((today (calendar-current-date))
228 (year (calendar-read 224 (year (calendar-read
@@ -267,6 +263,9 @@ Driven by the variable `calendar-date-display-form'."
267 (calendar-absolute-from-hebrew date))) 263 (calendar-absolute-from-hebrew date)))
268 (or noecho (calendar-print-hebrew-date))) 264 (or noecho (calendar-print-hebrew-date)))
269 265
266(defvar displayed-month) ; from generate-calendar
267(defvar displayed-year)
268
270;;;###holiday-autoload 269;;;###holiday-autoload
271(defun holiday-hebrew (month day string) 270(defun holiday-hebrew (month day string)
272 "Holiday on MONTH, DAY (Hebrew) called STRING. 271 "Holiday on MONTH, DAY (Hebrew) called STRING.
@@ -515,63 +514,64 @@ nil if it is not visible in the current calendar window."
515 (date string specifier &optional marker globcolor literal)) 514 (date string specifier &optional marker globcolor literal))
516 515
517(defvar number) ; from diary-list-entries 516(defvar number) ; from diary-list-entries
517(defvar original-date)
518 518
519;;;###diary-autoload 519;;;###diary-autoload
520(defun list-hebrew-diary-entries () 520(defun list-hebrew-diary-entries ()
521 "Add any Hebrew date entries from the diary file to `diary-entries-list'. 521 "Add any Hebrew date entries from the diary file to `diary-entries-list'.
522Hebrew date diary entries must be prefaced by `hebrew-diary-entry-symbol' 522Hebrew date diary entries must be prefaced by `hebrew-diary-entry-symbol'
523\(normally an `H'). The same diary date forms govern the style of the Hebrew 523\(normally an `H'). The same diary date forms govern the style
524calendar entries, except that the Hebrew month names must be spelled in full. 524of the Hebrew calendar entries, except that the Hebrew month
525The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being 525names must be spelled in full. The Hebrew months are numbered
526Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a 526from 1 to 13 with Nisan being 1, 12 being Adar I and 13 being
527common Hebrew year. If a Hebrew date diary entry begins with a 527Adar II; you must use `Adar I' if you want Adar of a common
528`diary-nonmarking-symbol', the entry will appear in the diary listing, but will 528Hebrew year. If a Hebrew date diary entry begins with
529not be marked in the calendar. This function is provided for use with the 529`diary-nonmarking-symbol', the entry will appear in the diary
530`nongregorian-diary-listing-hook'." 530listing, but will not be marked in the calendar. This function
531is provided for use with `nongregorian-diary-listing-hook'."
532 ;; FIXME this is very similar to the islamic and bahai functions.
531 (if (< 0 number) 533 (if (< 0 number)
532 (let ((buffer-read-only nil) 534 (let ((buffer-read-only nil)
533 (diary-modified (buffer-modified-p)) 535 (diary-modified (buffer-modified-p))
534 (gdate original-date) 536 (gdate original-date)
535 (mark (regexp-quote diary-nonmarking-symbol))) 537 (mark (regexp-quote diary-nonmarking-symbol)))
536 (dotimes (idummy number) 538 (dotimes (idummy number)
537 (let* ((d diary-date-forms) 539 (let* ((hdate (calendar-hebrew-from-absolute
538 (hdate (calendar-hebrew-from-absolute
539 (calendar-absolute-from-gregorian gdate))) 540 (calendar-absolute-from-gregorian gdate)))
540 (month (extract-calendar-month hdate)) 541 (month (extract-calendar-month hdate))
541 (day (extract-calendar-day hdate)) 542 (day (extract-calendar-day hdate))
542 (year (extract-calendar-year hdate))) 543 (year (extract-calendar-year hdate))
543 (while d 544 backup)
544 (let* 545 (dolist (date-form diary-date-forms)
545 ((date-form (if (equal (car (car d)) 'backup) 546 (if (setq backup (eq (car date-form) 'backup))
546 (cdr (car d)) 547 (setq date-form (cdr date-form)))
547 (car d))) 548 (let* ((dayname
548 (backup (equal (car (car d)) 'backup)) 549 (format "%s\\|%s\\.?"
549 (dayname 550 (calendar-day-name gdate)
550 (format "%s\\|%s\\.?" 551 (calendar-day-name gdate 'abbrev)))
551 (calendar-day-name gdate) 552 (calendar-month-name-array
552 (calendar-day-name gdate 'abbrev))) 553 calendar-hebrew-month-name-array-leap-year)
553 (calendar-month-name-array 554 (monthname
554 calendar-hebrew-month-name-array-leap-year) 555 (concat
555 (monthname 556 "\\*\\|"
556 (concat 557 (calendar-month-name month)))
557 "\\*\\|" 558 (month (concat "\\*\\|0*" (int-to-string month)))
558 (calendar-month-name month))) 559 (day (concat "\\*\\|0*" (int-to-string day)))
559 (month (concat "\\*\\|0*" (int-to-string month))) 560 (year
560 (day (concat "\\*\\|0*" (int-to-string day))) 561 (concat
561 (year 562 "\\*\\|0*" (int-to-string year)
562 (concat 563 (if abbreviated-calendar-year
563 "\\*\\|0*" (int-to-string year) 564 (concat "\\|" (int-to-string (% year 100)))
564 (if abbreviated-calendar-year 565 "")))
565 (concat "\\|" (int-to-string (% year 100))) 566 ;; FIXME get rid of ^M stuff.
566 ""))) 567 (regexp
567 (regexp 568 (concat
568 (concat 569 "\\(\\`\\|\^M\\|\n\\)" mark "?"
569 "\\(\\`\\|\^M\\|\n\\)" mark "?" 570 (regexp-quote hebrew-diary-entry-symbol)
570 (regexp-quote hebrew-diary-entry-symbol) 571 "\\("
571 "\\(" 572 (mapconcat 'eval date-form "\\)\\(")
572 (mapconcat 'eval date-form "\\)\\(") 573 "\\)"))
573 "\\)")) 574 (case-fold-search t))
574 (case-fold-search t))
575 (goto-char (point-min)) 575 (goto-char (point-min))
576 (while (re-search-forward regexp nil t) 576 (while (re-search-forward regexp nil t)
577 (if backup (re-search-backward "\\<" nil t)) 577 (if backup (re-search-backward "\\<" nil t))
@@ -596,8 +596,7 @@ not be marked in the calendar. This function is provided for use with the
596 (buffer-substring-no-properties entry-start (point)) 596 (buffer-substring-no-properties entry-start (point))
597 (buffer-substring-no-properties 597 (buffer-substring-no-properties
598 (1+ date-start) (1- entry-start)) 598 (1+ date-start) (1- entry-start))
599 (copy-marker entry-start)))))) 599 (copy-marker entry-start))))))))
600 (setq d (cdr d))))
601 (setq gdate 600 (setq gdate
602 (calendar-gregorian-from-absolute 601 (calendar-gregorian-from-absolute
603 (1+ (calendar-absolute-from-gregorian gdate))))) 602 (1+ (calendar-absolute-from-gregorian gdate)))))
@@ -700,40 +699,38 @@ Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a
700common Hebrew year. Hebrew date diary entries that begin with 699common Hebrew year. Hebrew date diary entries that begin with
701`diary-nonmarking-symbol' will not be marked in the calendar. This function 700`diary-nonmarking-symbol' will not be marked in the calendar. This function
702is provided for use as part of `nongregorian-diary-marking-hook'." 701is provided for use as part of `nongregorian-diary-marking-hook'."
703 (let ((d diary-date-forms)) 702 ;; FIXME this is very similar to the islamic and bahai functions.
704 (while d 703 (let ((dayname (diary-name-pattern calendar-day-name-array
705 (let* 704 calendar-day-abbrev-array))
706 ((date-form (if (equal (car (car d)) 'backup) 705 (monthname
707 (cdr (car d)) 706 (format "%s\\|\\*"
708 (car d))) ; ignore 'backup directive 707 (diary-name-pattern
709 (dayname (diary-name-pattern calendar-day-name-array 708 calendar-hebrew-month-name-array-leap-year)))
710 calendar-day-abbrev-array)) 709 (month "[0-9]+\\|\\*")
711 (monthname 710 (day "[0-9]+\\|\\*")
712 (format "%s\\|\\*" 711 (year "[0-9]+\\|\\*")
713 (diary-name-pattern 712 (case-fold-search t))
714 calendar-hebrew-month-name-array-leap-year))) 713 (dolist (date-form diary-date-forms)
715 (month "[0-9]+\\|\\*") 714 (if (eq (car date-form) 'backup) ; ignore 'backup directive
716 (day "[0-9]+\\|\\*") 715 (setq date-form (cdr date-form)))
717 (year "[0-9]+\\|\\*") 716 (let* ((l (length date-form))
718 (l (length date-form)) 717 (d-name-pos (- l (length (memq 'dayname date-form))))
719 (d-name-pos (- l (length (memq 'dayname date-form)))) 718 (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos)))
720 (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos))) 719 (m-name-pos (- l (length (memq 'monthname date-form))))
721 (m-name-pos (- l (length (memq 'monthname date-form)))) 720 (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos)))
722 (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos))) 721 (d-pos (- l (length (memq 'day date-form))))
723 (d-pos (- l (length (memq 'day date-form)))) 722 (d-pos (if (/= l d-pos) (+ 2 d-pos)))
724 (d-pos (if (/= l d-pos) (+ 2 d-pos))) 723 (m-pos (- l (length (memq 'month date-form))))
725 (m-pos (- l (length (memq 'month date-form)))) 724 (m-pos (if (/= l m-pos) (+ 2 m-pos)))
726 (m-pos (if (/= l m-pos) (+ 2 m-pos))) 725 (y-pos (- l (length (memq 'year date-form))))
727 (y-pos (- l (length (memq 'year date-form)))) 726 (y-pos (if (/= l y-pos) (+ 2 y-pos)))
728 (y-pos (if (/= l y-pos) (+ 2 y-pos))) 727 (regexp
729 (regexp 728 (concat
730 (concat 729 "\\(\\`\\|\^M\\|\n\\)"
731 "\\(\\`\\|\^M\\|\n\\)" 730 (regexp-quote hebrew-diary-entry-symbol)
732 (regexp-quote hebrew-diary-entry-symbol) 731 "\\("
733 "\\(" 732 (mapconcat 'eval date-form "\\)\\(")
734 (mapconcat 'eval date-form "\\)\\(") 733 "\\)")))
735 "\\)"))
736 (case-fold-search t))
737 (goto-char (point-min)) 734 (goto-char (point-min))
738 (while (re-search-forward regexp nil t) 735 (while (re-search-forward regexp nil t)
739 (let* ((dd-name 736 (let* ((dd-name
@@ -793,8 +790,7 @@ is provided for use as part of `nongregorian-diary-marking-hook'."
793 mm-name 790 mm-name
794 (calendar-make-alist 791 (calendar-make-alist
795 calendar-hebrew-month-name-array-leap-year) t))))) 792 calendar-hebrew-month-name-array-leap-year) t)))))
796 (mark-hebrew-calendar-date-pattern mm dd yy))))) 793 (mark-hebrew-calendar-date-pattern mm dd yy))))))))
797 (setq d (cdr d)))))
798 794
799;;;###cal-autoload 795;;;###cal-autoload
800(defun insert-hebrew-diary-entry (arg) 796(defun insert-hebrew-diary-entry (arg)
@@ -969,8 +965,9 @@ use when highlighting the day in the calendar."
969Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed 965Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed
970to be the name of the person. Date of death is on the *civil* calendar; 966to be the name of the person. Date of death is on the *civil* calendar;
971although the date of death is specified by the civil calendar, the proper 967although the date of death is specified by the civil calendar, the proper
972Hebrew calendar Yahrzeit is determined. If `european-calendar-style' is t, the 968Hebrew calendar Yahrzeit is determined. If `european-calendar-style' is
973order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR. 969non-nil, the order of the parameters is changed to DEATH-DAY, DEATH-MONTH,
970DEATH-YEAR.
974 971
975An optional parameter MARK specifies a face or single-character string to 972An optional parameter MARK specifies a face or single-character string to
976use when highlighting the day in the calendar." 973use when highlighting the day in the calendar."
@@ -1127,6 +1124,8 @@ use when highlighting the day in the calendar."
1127 (cdr parasha)))) 1124 (cdr parasha))))
1128 (hebrew-calendar-parasha-name parasha))))))))) 1125 (hebrew-calendar-parasha-name parasha)))))))))
1129 1126
1127;; FIXME none of the following are used for anything. ?
1128
1130;; The seven ordinary year types (keviot). 1129;; The seven ordinary year types (keviot).
1131(defconst hebrew-calendar-year-Saturday-incomplete-Sunday 1130(defconst hebrew-calendar-year-Saturday-incomplete-Sunday
1132 [nil 52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 1131 [nil 52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22]