Function: diary-hebrew-parasha

diary-hebrew-parasha is an autoloaded and byte-compiled function defined in cal-hebrew.el.gz.

Signature

(diary-hebrew-parasha &optional MARK)

Documentation

Parasha diary entry--entry applies if date is a Saturday.

An optional parameter MARK specifies a face or single-character string to use when highlighting the day in the calendar.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-hebrew.el.gz
;;;###diary-autoload
(defun diary-hebrew-parasha (&optional mark)
  "Parasha diary entry--entry applies if date is a Saturday.
An optional parameter MARK specifies a face or single-character string to
use when highlighting the day in the calendar."
  (let ((d (calendar-absolute-from-gregorian date)))
    (if (= (% d 7) 6)                   ; Saturday
        (let* ((h-year (calendar-extract-year
                        (calendar-hebrew-from-absolute d)))
               (rosh-hashanah
                (calendar-hebrew-to-absolute (list 7 1 h-year)))
               (passover
                (calendar-hebrew-to-absolute (list 1 15 h-year)))
               (rosh-hashanah-day
                (aref calendar-day-name-array (% rosh-hashanah 7)))
               (passover-day
                (aref calendar-day-name-array (% passover 7)))
               (long-h (calendar-hebrew-long-heshvan-p h-year))
               (short-k (calendar-hebrew-short-kislev-p h-year))
               (type (cond ((and long-h (not short-k)) "complete")
                           ((and (not long-h) short-k) "incomplete")
                           (t "regular")))
               (year-format
                (symbol-value
                 (intern (format "calendar-hebrew-year-%s-%s-%s" ; keviah
                                 rosh-hashanah-day type passover-day))))
               (first-saturday            ; of Hebrew year
                (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))
               (saturday             ; which Saturday of the Hebrew year
                (/ (- d first-saturday) 7))
               (parasha (aref year-format saturday)))
          (if parasha
              (cons mark
                    (format
                     "Parashat %s"
                     (if (listp parasha) ; Israel differs from diaspora
                         (if (car parasha)
                             (format "%s (diaspora), %s (Israel)"
                                     (calendar-hebrew-parasha-name
                                      (car parasha))
                                     (calendar-hebrew-parasha-name
                                      (cdr parasha)))
                           (format "%s (Israel)"
                                   (calendar-hebrew-parasha-name
                                    (cdr parasha))))
                       (calendar-hebrew-parasha-name parasha)))))))))