mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-14 09:39:42 +00:00
(persian-calendar-month-name-array, persian-calendar-epoch): Make constants.
(persian-prompt-for-date): Use zerop.
This commit is contained in:
parent
5fc5b6e169
commit
b0b671db10
@ -1,7 +1,7 @@
|
||||
;;; cal-persia.el --- calendar functions for the Persian calendar
|
||||
|
||||
;; Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
;; Free Software Foundation, Inc.
|
||||
;; Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
;; 2008 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
|
||||
;; Maintainer: Glenn Morris <rgm@gnu.org>
|
||||
@ -32,28 +32,25 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar date)
|
||||
|
||||
(require 'cal-julian)
|
||||
|
||||
(defvar persian-calendar-month-name-array
|
||||
(defconst persian-calendar-month-name-array
|
||||
["Farvardin" "Ordibehest" "Xordad" "Tir" "Mordad" "Sahrivar" "Mehr" "Aban"
|
||||
"Azar" "Dey" "Bahman" "Esfand"])
|
||||
|
||||
(defvar persian-calendar-epoch (calendar-absolute-from-julian '(3 19 622))
|
||||
(defconst persian-calendar-epoch (calendar-absolute-from-julian '(3 19 622))
|
||||
"Absolute date of start of Persian calendar = March 19, 622 A.D. (Julian).")
|
||||
|
||||
(defun persian-calendar-leap-year-p (year)
|
||||
"True if YEAR is a leap year on the Persian calendar."
|
||||
(< (mod (* (mod (mod (if (<= 0 year)
|
||||
; No year zero
|
||||
(+ year 2346)
|
||||
(+ year 2346) ; no year zero
|
||||
(+ year 2347))
|
||||
2820)
|
||||
768)
|
||||
683)
|
||||
2820)
|
||||
683))
|
||||
683)
|
||||
2820)
|
||||
683))
|
||||
|
||||
(defun persian-calendar-last-day-of-month (month year)
|
||||
"Return last day of MONTH, YEAR on the Persian calendar."
|
||||
@ -177,7 +174,7 @@ Echo Persian date unless NOECHO is t."
|
||||
(let* ((today (calendar-current-date))
|
||||
(year (calendar-read
|
||||
"Persian calendar year (not 0): "
|
||||
(lambda (x) (/= x 0))
|
||||
(lambda (x) (not (zerop x)))
|
||||
(int-to-string
|
||||
(extract-calendar-year
|
||||
(calendar-persian-from-absolute
|
||||
@ -197,6 +194,9 @@ Echo Persian date unless NOECHO is t."
|
||||
(lambda (x) (and (< 0 x) (<= x last))))))
|
||||
(list (list month day year))))
|
||||
|
||||
(defvar date)
|
||||
|
||||
;; To be called from list-sexp-diary-entries, where DATE is bound.
|
||||
(defun diary-persian-date ()
|
||||
"Persian calendar equivalent of date diary entry."
|
||||
(format "Persian date: %s" (calendar-persian-date-string date)))
|
||||
|
Loading…
Reference in New Issue
Block a user