aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2018-12-01 09:43:37 -0500
committerStefan Monnier2018-12-01 09:43:37 -0500
commit070ef95c1007cb3d54e04bc337d9fb5463912cc1 (patch)
tree4c0d3e6218ece5beb3cb2c48cab08654d1642de6
parenta8d178816a8926616736f25f0cc2e7aad38ceaf7 (diff)
downloademacs-070ef95c1007cb3d54e04bc337d9fb5463912cc1.tar.gz
emacs-070ef95c1007cb3d54e04bc337d9fb5463912cc1.zip
* lisp/calendar/holidays.el: Use lexical-binding
Remove redundant :group arguments. (holiday-sexp): Bind 'year' and 'date' dynamically for 'sexp' and 'string'.
-rw-r--r--lisp/calendar/holidays.el65
1 files changed, 28 insertions, 37 deletions
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index f38308378d6..62b9d778e2e 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -1,4 +1,4 @@
1;;; holidays.el --- holiday functions for the calendar package 1;;; holidays.el --- holiday functions for the calendar package -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2018 Free Software 3;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2018 Free Software
4;; Foundation, Inc. 4;; Foundation, Inc.
@@ -64,8 +64,7 @@
64 (holiday-float 11 4 4 "Thanksgiving"))) 64 (holiday-float 11 4 4 "Thanksgiving")))
65 "General holidays. Default value is for the United States. 65 "General holidays. Default value is for the United States.
66See the documentation for `calendar-holidays' for details." 66See the documentation for `calendar-holidays' for details."
67 :type 'sexp 67 :type 'sexp)
68 :group 'holidays)
69;;;###autoload 68;;;###autoload
70(put 'holiday-general-holidays 'risky-local-variable t) 69(put 'holiday-general-holidays 'risky-local-variable t)
71 70
@@ -86,8 +85,7 @@ See the documentation for `calendar-holidays' for details."
86 "Oriental holidays. 85 "Oriental holidays.
87See the documentation for `calendar-holidays' for details." 86See the documentation for `calendar-holidays' for details."
88 :version "23.1" ; added more holidays 87 :version "23.1" ; added more holidays
89 :type 'sexp 88 :type 'sexp)
90 :group 'holidays)
91;;;###autoload 89;;;###autoload
92(put 'holiday-oriental-holidays 'risky-local-variable t) 90(put 'holiday-oriental-holidays 'risky-local-variable t)
93 91
@@ -95,8 +93,7 @@ See the documentation for `calendar-holidays' for details."
95(defcustom holiday-local-holidays nil 93(defcustom holiday-local-holidays nil
96 "Local holidays. 94 "Local holidays.
97See the documentation for `calendar-holidays' for details." 95See the documentation for `calendar-holidays' for details."
98 :type 'sexp 96 :type 'sexp)
99 :group 'holidays)
100;;;###autoload 97;;;###autoload
101(put 'holiday-local-holidays 'risky-local-variable t) 98(put 'holiday-local-holidays 'risky-local-variable t)
102 99
@@ -104,8 +101,7 @@ See the documentation for `calendar-holidays' for details."
104(defcustom holiday-other-holidays nil 101(defcustom holiday-other-holidays nil
105 "User defined holidays. 102 "User defined holidays.
106See the documentation for `calendar-holidays' for details." 103See the documentation for `calendar-holidays' for details."
107 :type 'sexp 104 :type 'sexp)
108 :group 'holidays)
109;;;###autoload 105;;;###autoload
110(put 'holiday-other-holidays 'risky-local-variable t) 106(put 'holiday-other-holidays 'risky-local-variable t)
111 107
@@ -122,8 +118,8 @@ See the documentation for `calendar-holidays' for details."
122 "Jewish holidays. 118 "Jewish holidays.
123See the documentation for `calendar-holidays' for details." 119See the documentation for `calendar-holidays' for details."
124 :type 'sexp 120 :type 'sexp
125 :version "23.1" ; removed dependency on hebrew-holidays-N 121 :version "23.1") ; removed dependency on hebrew-holidays-N
126 :group 'holidays) 122
127;;;###autoload 123;;;###autoload
128(put 'holiday-hebrew-holidays 'risky-local-variable t) 124(put 'holiday-hebrew-holidays 'risky-local-variable t)
129 125
@@ -141,8 +137,7 @@ See the documentation for `calendar-holidays' for details."
141 (holiday-advent 0 "Advent"))))) 137 (holiday-advent 0 "Advent")))))
142 "Christian holidays. 138 "Christian holidays.
143See the documentation for `calendar-holidays' for details." 139See the documentation for `calendar-holidays' for details."
144 :type 'sexp 140 :type 'sexp)
145 :group 'holidays)
146;;;###autoload 141;;;###autoload
147(put 'holiday-christian-holidays 'risky-local-variable t) 142(put 'holiday-christian-holidays 'risky-local-variable t)
148 143
@@ -162,8 +157,7 @@ See the documentation for `calendar-holidays' for details."
162 (holiday-islamic 12 10 "Id-al-Adha"))))) 157 (holiday-islamic 12 10 "Id-al-Adha")))))
163 "Islamic holidays. 158 "Islamic holidays.
164See the documentation for `calendar-holidays' for details." 159See the documentation for `calendar-holidays' for details."
165 :type 'sexp 160 :type 'sexp)
166 :group 'holidays)
167;;;###autoload 161;;;###autoload
168(put 'holiday-islamic-holidays 'risky-local-variable t) 162(put 'holiday-islamic-holidays 'risky-local-variable t)
169 163
@@ -183,8 +177,7 @@ See the documentation for `calendar-holidays' for details."
183 (holiday-fixed 11 28 "Ascension of `Abdu’l-Bahá"))))) 177 (holiday-fixed 11 28 "Ascension of `Abdu’l-Bahá")))))
184 "Bahá’í holidays. 178 "Bahá’í holidays.
185See the documentation for `calendar-holidays' for details." 179See the documentation for `calendar-holidays' for details."
186 :type 'sexp 180 :type 'sexp)
187 :group 'holidays)
188;;;###autoload 181;;;###autoload
189(put 'holiday-bahai-holidays 'risky-local-variable t) 182(put 'holiday-bahai-holidays 'risky-local-variable t)
190 183
@@ -204,8 +197,7 @@ See the documentation for `calendar-holidays' for details."
204 calendar-daylight-time-zone-name))))) 197 calendar-daylight-time-zone-name)))))
205 "Sun-related holidays. 198 "Sun-related holidays.
206See the documentation for `calendar-holidays' for details." 199See the documentation for `calendar-holidays' for details."
207 :type 'sexp 200 :type 'sexp)
208 :group 'holidays)
209;;;###autoload 201;;;###autoload
210(put 'holiday-solar-holidays 'risky-local-variable t) 202(put 'holiday-solar-holidays 'risky-local-variable t)
211 203
@@ -323,8 +315,7 @@ you've written to return a (possibly empty) list of the relevant VISIBLE dates
323with descriptive strings such as 315with descriptive strings such as
324 316
325 (((2 6 1989) \"New Moon\") ((2 12 1989) \"First Quarter Moon\") ... )." 317 (((2 6 1989) \"New Moon\") ((2 12 1989) \"First Quarter Moon\") ... )."
326 :type 'sexp 318 :type 'sexp)
327 :group 'holidays)
328;;;###autoload 319;;;###autoload
329(put 'calendar-holidays 'risky-local-variable t) 320(put 'calendar-holidays 'risky-local-variable t)
330 321
@@ -336,14 +327,14 @@ with descriptive strings such as
336(defun calendar-holiday-list () 327(defun calendar-holiday-list ()
337 "Form the list of holidays that occur on dates in the calendar window. 328 "Form the list of holidays that occur on dates in the calendar window.
338The holidays are those in the list `calendar-holidays'." 329The holidays are those in the list `calendar-holidays'."
339 (let (res h err) 330 (let (res h)
340 (sort 331 (sort
341 (dolist (p calendar-holidays res) 332 (dolist (p calendar-holidays res)
342 (if (setq h (if calendar-debug-sexp 333 (if (setq h (if calendar-debug-sexp
343 (let ((debug-on-error t)) 334 (let ((debug-on-error t))
344 (eval p)) 335 (eval p t))
345 (condition-case err 336 (condition-case err
346 (eval p) 337 (eval p t)
347 (error 338 (error
348 (display-warning 339 (display-warning
349 'holidays 340 'holidays
@@ -470,7 +461,7 @@ The optional LABEL is used to label the buffer created."
470 (choice (capitalize 461 (choice (capitalize
471 (completing-read "List (TAB for choices): " lists nil t))) 462 (completing-read "List (TAB for choices): " lists nil t)))
472 (which (if (string-equal choice "Ask") 463 (which (if (string-equal choice "Ask")
473 (eval (read-variable "Enter list name: ")) 464 (symbol-value (read-variable "Enter list name: "))
474 (cdr (assoc choice lists)))) 465 (cdr (assoc choice lists))))
475 (name (if (string-equal choice "Equinoxes/Solstices") 466 (name (if (string-equal choice "Equinoxes/Solstices")
476 choice 467 choice
@@ -536,7 +527,7 @@ strings describing those holidays that apply on DATE, or nil if none do."
536 3))) 527 3)))
537 holidays in-range a) 528 holidays in-range a)
538 (calendar-increment-month displayed-month displayed-year 1) 529 (calendar-increment-month displayed-month displayed-year 1)
539 (dotimes (_idummy number-of-intervals) 530 (dotimes (_ number-of-intervals)
540 (setq holidays (append holidays (calendar-holiday-list))) 531 (setq holidays (append holidays (calendar-holiday-list)))
541 (calendar-increment-month displayed-month displayed-year 3)) 532 (calendar-increment-month displayed-month displayed-year 3))
542 (dolist (hol holidays) 533 (dolist (hol holidays)
@@ -690,19 +681,19 @@ the holiday description of `date'. If `date' is visible in the
690calendar window, the holiday STRING is on that date. If date is 681calendar window, the holiday STRING is on that date. If date is
691nil, or if the date is not visible, there is no holiday." 682nil, or if the date is not visible, there is no holiday."
692 (let ((m displayed-month) 683 (let ((m displayed-month)
693 (y displayed-year) 684 (y displayed-year))
694 year date)
695 (calendar-increment-month m y -1) 685 (calendar-increment-month m y -1)
696 (holiday-filter-visible-calendar 686 (holiday-filter-visible-calendar
697 (list 687 (calendar-dlet* (year date)
698 (progn 688 (list
699 (setq year y 689 (progn
700 date (eval sexp)) 690 (setq year y
701 (list date (if date (eval string)))) 691 date (eval sexp t))
702 (progn 692 (list date (if date (eval string t))))
703 (setq year (1+ y) 693 (progn
704 date (eval sexp)) 694 (setq year (1+ y)
705 (list date (if date (eval string)))))))) 695 date (eval sexp t))
696 (list date (if date (eval string t)))))))))
706 697
707 698
708(defun holiday-advent (&optional n string) 699(defun holiday-advent (&optional n string)