emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 070ef95: * lisp/calendar/holidays.el: Use lexical-b


From: Stefan Monnier
Subject: [Emacs-diffs] master 070ef95: * lisp/calendar/holidays.el: Use lexical-binding
Date: Sat, 1 Dec 2018 09:43:48 -0500 (EST)

branch: master
commit 070ef95c1007cb3d54e04bc337d9fb5463912cc1
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/calendar/holidays.el: Use lexical-binding
    
    Remove redundant :group arguments.
    (holiday-sexp): Bind 'year' and 'date' dynamically for 'sexp' and 'string'.
---
 lisp/calendar/holidays.el | 65 ++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 37 deletions(-)

diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index f383083..62b9d77 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -1,4 +1,4 @@
-;;; holidays.el --- holiday functions for the calendar package
+;;; holidays.el --- holiday functions for the calendar package  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2018 Free Software
 ;; Foundation, Inc.
@@ -64,8 +64,7 @@
     (holiday-float 11 4 4 "Thanksgiving")))
   "General holidays.  Default value is for the United States.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-general-holidays 'risky-local-variable t)
 
@@ -86,8 +85,7 @@ See the documentation for `calendar-holidays' for details."
   "Oriental holidays.
 See the documentation for `calendar-holidays' for details."
   :version "23.1"                       ; added more holidays
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-oriental-holidays 'risky-local-variable t)
 
@@ -95,8 +93,7 @@ See the documentation for `calendar-holidays' for details."
 (defcustom holiday-local-holidays nil
   "Local holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-local-holidays 'risky-local-variable t)
 
@@ -104,8 +101,7 @@ See the documentation for `calendar-holidays' for details."
 (defcustom holiday-other-holidays nil
   "User defined holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-other-holidays 'risky-local-variable t)
 
@@ -122,8 +118,8 @@ See the documentation for `calendar-holidays' for details."
   "Jewish holidays.
 See the documentation for `calendar-holidays' for details."
   :type 'sexp
-  :version "23.1"            ; removed dependency on hebrew-holidays-N
-  :group 'holidays)
+  :version "23.1")            ; removed dependency on hebrew-holidays-N
+
 ;;;###autoload
 (put 'holiday-hebrew-holidays 'risky-local-variable t)
 
@@ -141,8 +137,7 @@ See the documentation for `calendar-holidays' for details."
          (holiday-advent 0 "Advent")))))
   "Christian holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-christian-holidays 'risky-local-variable t)
 
@@ -162,8 +157,7 @@ See the documentation for `calendar-holidays' for details."
          (holiday-islamic 12 10 "Id-al-Adha")))))
   "Islamic holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-islamic-holidays 'risky-local-variable t)
 
@@ -183,8 +177,7 @@ See the documentation for `calendar-holidays' for details."
          (holiday-fixed 11 28 "Ascension of `Abdu’l-Bahá")))))
   "Bahá’í holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-bahai-holidays 'risky-local-variable t)
 
@@ -204,8 +197,7 @@ See the documentation for `calendar-holidays' for details."
                            calendar-daylight-time-zone-name)))))
   "Sun-related holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-solar-holidays 'risky-local-variable t)
 
@@ -323,8 +315,7 @@ you've written to return a (possibly empty) list of the 
relevant VISIBLE dates
 with descriptive strings such as
 
      (((2 6 1989) \"New Moon\") ((2 12 1989) \"First Quarter Moon\") ... )."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'calendar-holidays 'risky-local-variable t)
 
@@ -336,14 +327,14 @@ with descriptive strings such as
 (defun calendar-holiday-list ()
   "Form the list of holidays that occur on dates in the calendar window.
 The holidays are those in the list `calendar-holidays'."
-  (let (res h err)
+  (let (res h)
     (sort
      (dolist (p calendar-holidays res)
        (if (setq h (if calendar-debug-sexp
                        (let ((debug-on-error t))
-                         (eval p))
+                         (eval p t))
                      (condition-case err
-                         (eval p)
+                         (eval p t)
                        (error
                         (display-warning
                          'holidays
@@ -470,7 +461,7 @@ The optional LABEL is used to label the buffer created."
           (choice (capitalize
                    (completing-read "List (TAB for choices): " lists nil t)))
           (which (if (string-equal choice "Ask")
-                     (eval (read-variable "Enter list name: "))
+                     (symbol-value (read-variable "Enter list name: "))
                    (cdr (assoc choice lists))))
           (name (if (string-equal choice "Equinoxes/Solstices")
                     choice
@@ -536,7 +527,7 @@ strings describing those holidays that apply on DATE, or 
nil if none do."
                  3)))
          holidays in-range a)
     (calendar-increment-month displayed-month displayed-year 1)
-    (dotimes (_idummy number-of-intervals)
+    (dotimes (_ number-of-intervals)
       (setq holidays (append holidays (calendar-holiday-list)))
       (calendar-increment-month displayed-month displayed-year 3))
     (dolist (hol holidays)
@@ -690,19 +681,19 @@ the holiday description of `date'.  If `date' is visible 
in the
 calendar window, the holiday STRING is on that date.  If date is
 nil, or if the date is not visible, there is no holiday."
   (let ((m displayed-month)
-        (y displayed-year)
-        year date)
+        (y displayed-year))
     (calendar-increment-month m y -1)
     (holiday-filter-visible-calendar
-     (list
-      (progn
-        (setq year y
-              date (eval sexp))
-        (list date (if date (eval string))))
-      (progn
-        (setq year (1+ y)
-              date (eval sexp))
-        (list date (if date (eval string))))))))
+     (calendar-dlet* (year date)
+       (list
+        (progn
+          (setq year y
+                date (eval sexp t))
+          (list date (if date (eval string t))))
+        (progn
+          (setq year (1+ y)
+                date (eval sexp t))
+          (list date (if date (eval string t)))))))))
 
 
 (defun holiday-advent (&optional n string)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]