mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-29 19:48:19 +00:00
Make dlet work like let, not let*
Change `dlet` so that it has binding semantics like `let` because that is what a user would expect and it allows a corresponding `dlet*` to be added later should the need arise. Fortunately the change has no effect where it is currently used. * lisp/subr.el (dlet): Work like let. * lisp/calendar/cal-bahai.el (calendar-bahai-date-string): * lisp/calendar/cal-coptic.el (calendar-coptic-date-string): * lisp/calendar/cal-dst.el (calendar-time-zone-daylight-rules) (calendar-dst-starts, dst-in-effect): * lisp/calendar/cal-persia.el (calendar-persian-date-string): * lisp/calendar/calendar.el (calendar-dlet, calendar-generate-month) (calendar-update-mode-line, calendar-date-string): * lisp/calendar/diary-lib.el (diary-list-entries-2) (diary-list-entries, diary-mark-entries-1, diary-sexp-entry) (diary-remind, diary-font-lock-date-forms, diary-fancy-date-pattern): * lisp/calendar/holidays.el (holiday-sexp): * lisp/calendar/icalendar.el (icalendar--convert-float-to-ical): * lisp/calendar/solar.el (solar-time-string): * lisp/calendar/todo-mode.el (todo-date-pattern) (todo-edit-item--header, todo-convert-legacy-date-time) (todo-read-date): Rename `calendar-dlet*` to `calendar-dlet` since it uses `dlet`.
This commit is contained in:
parent
3b7f72ca55
commit
b72f88518b
@ -126,7 +126,7 @@ Defaults to today's date if DATE is not given."
|
||||
"" ; pre-Bahai
|
||||
(let ((m (calendar-extract-month bahai-date))
|
||||
(d (calendar-extract-day bahai-date)))
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((monthname (if (and (= m 19)
|
||||
(<= d 0))
|
||||
"Ayyám-i-Há"
|
||||
|
@ -116,7 +116,7 @@ Defaults to today's date if DATE is not given."
|
||||
(m (calendar-extract-month coptic-date)))
|
||||
(if (< y 1)
|
||||
""
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((monthname (aref calendar-coptic-month-name-array (1- m)))
|
||||
(day (number-to-string (calendar-extract-day coptic-date)))
|
||||
(dayname nil)
|
||||
|
@ -200,7 +200,7 @@ The result has the proper form for `calendar-daylight-savings-starts'."
|
||||
(calendar-persian-to-absolute `(7 1 ,(- year 621))))))))
|
||||
(prevday-sec (- -1 utc-diff)) ; last sec of previous local day
|
||||
new-rules)
|
||||
(calendar-dlet* ((year (1+ y)))
|
||||
(calendar-dlet ((year (1+ y)))
|
||||
;; Scan through the next few years until only one rule remains.
|
||||
(while (cdr candidate-rules)
|
||||
(dolist (rule candidate-rules)
|
||||
@ -397,7 +397,7 @@ This function respects the value of `calendar-dst-check-each-year-flag'."
|
||||
(or (let ((expr (if calendar-dst-check-each-year-flag
|
||||
(cadr (calendar-dst-find-startend year))
|
||||
(nth 4 calendar-current-time-zone-cache))))
|
||||
(calendar-dlet* ((year year))
|
||||
(calendar-dlet ((year year))
|
||||
(if expr (eval expr))))
|
||||
;; New US rules commencing 2007. https://www.iana.org/time-zones
|
||||
(and (not (zerop calendar-daylight-time-offset))
|
||||
@ -409,7 +409,7 @@ This function respects the value of `calendar-dst-check-each-year-flag'."
|
||||
(or (let ((expr (if calendar-dst-check-each-year-flag
|
||||
(nth 2 (calendar-dst-find-startend year))
|
||||
(nth 5 calendar-current-time-zone-cache))))
|
||||
(calendar-dlet* ((year year))
|
||||
(calendar-dlet ((year year))
|
||||
(if expr (eval expr))))
|
||||
;; New US rules commencing 2007. https://www.iana.org/time-zones
|
||||
(and (not (zerop calendar-daylight-time-offset))
|
||||
@ -419,7 +419,7 @@ This function respects the value of `calendar-dst-check-each-year-flag'."
|
||||
(defun dst-in-effect (date)
|
||||
"True if on absolute DATE daylight saving time is in effect.
|
||||
Fractional part of DATE is local standard time of day."
|
||||
(calendar-dlet* ((year (calendar-extract-year
|
||||
(calendar-dlet ((year (calendar-extract-year
|
||||
(calendar-gregorian-from-absolute (floor date)))))
|
||||
(let* ((dst-starts-gregorian (eval calendar-daylight-savings-starts))
|
||||
(dst-ends-gregorian (eval calendar-daylight-savings-ends))
|
||||
|
@ -140,7 +140,7 @@ Gregorian date Sunday, December 31, 1 BC."
|
||||
(or date (calendar-current-date)))))
|
||||
(y (calendar-extract-year persian-date))
|
||||
(m (calendar-extract-month persian-date)))
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((monthname (aref calendar-persian-month-name-array (1- m)))
|
||||
(day (number-to-string (calendar-extract-day persian-date)))
|
||||
(year (number-to-string y))
|
||||
|
@ -137,7 +137,7 @@
|
||||
;; - whatever is passed to diary-sexp-entry
|
||||
;; - whatever is passed to diary-remind
|
||||
|
||||
(defmacro calendar-dlet* (binders &rest body)
|
||||
(defmacro calendar-dlet (binders &rest body)
|
||||
"Like `dlet' but without warnings about non-prefixed var names."
|
||||
(declare (indent 1) (debug let))
|
||||
(let ((vars (mapcar (lambda (binder)
|
||||
@ -1499,7 +1499,7 @@ first INDENT characters on the line."
|
||||
(goto-char (point-min))
|
||||
(calendar-move-to-column indent)
|
||||
(insert
|
||||
(calendar-dlet* ((month month) (year year))
|
||||
(calendar-dlet ((month month) (year year))
|
||||
(calendar-string-spread (list calendar-month-header)
|
||||
?\s calendar-month-digit-width)))
|
||||
(calendar-ensure-newline)
|
||||
@ -1516,7 +1516,7 @@ first INDENT characters on the line."
|
||||
calendar-day-header-width nil ?\s)
|
||||
(make-string (- calendar-column-width calendar-day-header-width) ?\s)))
|
||||
(calendar-ensure-newline)
|
||||
(calendar-dlet* ((day day) (month month) (year year))
|
||||
(calendar-dlet ((day day) (month month) (year year))
|
||||
(calendar-insert-at-column indent calendar-intermonth-text trunc))
|
||||
;; Add blank days before the first of the month.
|
||||
(insert (make-string (* blank-days calendar-column-width) ?\s))
|
||||
@ -1527,7 +1527,7 @@ first INDENT characters on the line."
|
||||
(insert (propertize
|
||||
(format (format "%%%dd" calendar-day-digit-width) day)
|
||||
'mouse-face 'highlight
|
||||
'help-echo (calendar-dlet* ((day day) (month month) (year year))
|
||||
'help-echo (calendar-dlet ((day day) (month month) (year year))
|
||||
(eval calendar-date-echo-text t))
|
||||
;; 'date property prevents intermonth text confusing re-searches.
|
||||
;; (Tried intangible, it did not really work.)
|
||||
@ -1538,7 +1538,7 @@ first INDENT characters on the line."
|
||||
(/= day last))
|
||||
(calendar-ensure-newline)
|
||||
(setq day (1+ day)) ; first day of next week
|
||||
(calendar-dlet* ((day day) (month month) (year year))
|
||||
(calendar-dlet ((day day) (month month) (year year))
|
||||
(calendar-insert-at-column indent calendar-intermonth-text trunc))))))
|
||||
|
||||
(defun calendar-redraw ()
|
||||
@ -1833,7 +1833,7 @@ concatenated and the result truncated."
|
||||
(bufferp (get-buffer calendar-buffer)))
|
||||
(with-current-buffer calendar-buffer
|
||||
(let ((start (- calendar-left-margin 2)))
|
||||
(calendar-dlet* ((date (condition-case nil
|
||||
(calendar-dlet ((date (condition-case nil
|
||||
(calendar-cursor-to-nearest-date)
|
||||
(error (calendar-current-date)))))
|
||||
(setq mode-line-format
|
||||
@ -2561,7 +2561,7 @@ and day names to be abbreviated as specified by
|
||||
respectively. An optional parameter NODAYNAME, when t, omits the
|
||||
name of the day of the week."
|
||||
(let ((month (calendar-extract-month date)))
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((dayname (unless nodayname (calendar-day-name date abbreviate)))
|
||||
(monthname (calendar-month-name month abbreviate))
|
||||
(day (number-to-string (calendar-extract-day date)))
|
||||
|
@ -663,7 +663,7 @@ any entries were found."
|
||||
(calendar-month-name-array (or months calendar-month-name-array))
|
||||
(case-fold-search t)
|
||||
entry-found)
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((dayname (format "%s\\|%s\\.?" (calendar-day-name date)
|
||||
(calendar-day-name date 'abbrev)))
|
||||
(monthname (format "\\*\\|%s%s" (calendar-month-name month)
|
||||
@ -858,7 +858,7 @@ LIST-ONLY is non-nil, in which case it just returns the list."
|
||||
;; every time, diary-include-other-diary-files
|
||||
;; binds it to nil (essentially) when it runs
|
||||
;; in included files.
|
||||
(calendar-dlet* ((number number)
|
||||
(calendar-dlet ((number number)
|
||||
(list-only list-only))
|
||||
(run-hooks 'diary-nongregorian-listing-hook
|
||||
'diary-list-entries-hook))
|
||||
@ -877,7 +877,7 @@ LIST-ONLY is non-nil, in which case it just returns the list."
|
||||
(copy-sequence
|
||||
(car display-buffer-fallback-action))))))
|
||||
(funcall diary-display-function)))
|
||||
(calendar-dlet* ((number number)
|
||||
(calendar-dlet ((number number)
|
||||
(original-date original-date))
|
||||
(run-hooks 'diary-hook))))))
|
||||
(and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
|
||||
@ -1266,7 +1266,7 @@ MARKFUNC is a function that marks entries of the appropriate type
|
||||
matching a given date pattern. MONTHS is an array of month names.
|
||||
SYMBOL marks diary entries of the type in question. ABSFUNC is a
|
||||
function that converts absolute dates to dates of the appropriate type."
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((dayname (diary-name-pattern calendar-day-name-array
|
||||
calendar-day-abbrev-array))
|
||||
(monthname (format "%s\\|\\*"
|
||||
@ -1435,7 +1435,7 @@ marks. This is intended to deal with deleted diary entries."
|
||||
(defun diary-sexp-entry (sexp entry date)
|
||||
"Process a SEXP diary ENTRY for DATE."
|
||||
(let ((result
|
||||
(calendar-dlet* ((date date)
|
||||
(calendar-dlet ((date date)
|
||||
(entry entry))
|
||||
(if calendar-debug-sexp
|
||||
(let ((debug-on-error t))
|
||||
@ -2043,7 +2043,7 @@ calendar."
|
||||
(and (integerp days)
|
||||
(< days 0)
|
||||
(setq days (number-sequence 1 (- days))))
|
||||
(calendar-dlet* ((diary-entry (eval sexp)))
|
||||
(calendar-dlet ((diary-entry (eval sexp)))
|
||||
(cond
|
||||
;; Diary entry applies on date.
|
||||
((and diary-entry
|
||||
@ -2059,7 +2059,7 @@ calendar."
|
||||
(when (setq diary-entry (eval sexp))
|
||||
;; Discard any mark portion from diary-anniversary, etc.
|
||||
(if (consp diary-entry) (setq diary-entry (cdr diary-entry)))
|
||||
(calendar-dlet* ((days days))
|
||||
(calendar-dlet ((days days))
|
||||
(mapconcat #'eval diary-remind-message "")))))
|
||||
;; Diary entry may apply to one of a list of days before date.
|
||||
((and (listp days) days)
|
||||
@ -2264,7 +2264,7 @@ If given, optional SYMBOL must be a prefix to entries. If
|
||||
optional ABBREV-ARRAY is present, also matches the abbreviations
|
||||
from this array (with or without a final `.'), in addition to the
|
||||
full month names."
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((dayname (diary-name-pattern calendar-day-name-array
|
||||
calendar-day-abbrev-array t))
|
||||
(monthname (format "\\(%s\\|\\*\\)"
|
||||
@ -2400,7 +2400,7 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL."
|
||||
This depends on the calendar date style."
|
||||
(declare (obsolete nil "28.1"))
|
||||
(concat
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((dayname (diary-name-pattern calendar-day-name-array nil t))
|
||||
(monthname (diary-name-pattern calendar-month-name-array nil t))
|
||||
(day "1")
|
||||
|
@ -683,7 +683,7 @@ nil, or if the date is not visible, there is no holiday."
|
||||
(y displayed-year))
|
||||
(calendar-increment-month m y -1)
|
||||
(holiday-filter-visible-calendar
|
||||
(calendar-dlet* (year date)
|
||||
(calendar-dlet (year date)
|
||||
(list
|
||||
(progn
|
||||
(setq year y
|
||||
|
@ -1783,8 +1783,8 @@ entries. ENTRY-MAIN is the first line of the diary entry."
|
||||
;;BUT remove today if `diary-float'
|
||||
;;expression does not hold true for today:
|
||||
(when
|
||||
(null (calendar-dlet* ((date (calendar-current-date))
|
||||
(entry entry-main))
|
||||
(null (calendar-dlet ((date (calendar-current-date))
|
||||
(entry entry-main))
|
||||
(diary-float month dayname n)))
|
||||
(concat
|
||||
"\nEXDATE;VALUE=DATE:"
|
||||
|
@ -552,7 +552,7 @@ degrees to find out if polar regions have 24 hours of sun or only night."
|
||||
Format used is given by `calendar-time-display-form'."
|
||||
(let* ((time (round (* 60 time)))
|
||||
(24-hours (/ time 60)))
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((time-zone time-zone)
|
||||
(minutes (format "%02d" (% time 60)))
|
||||
(12-hours (format "%d" (1+ (% (+ 24-hours 11) 12))))
|
||||
|
@ -191,7 +191,7 @@ The final element is \"*\", indicating an unspecified month.")
|
||||
(defconst todo-date-pattern
|
||||
(let ((dayname (diary-name-pattern calendar-day-name-array nil t)))
|
||||
(concat "\\(?4:\\(?5:" dayname "\\)\\|"
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((dayname)
|
||||
(monthname (format "\\(?6:%s\\)" (diary-name-pattern
|
||||
todo-month-name-array
|
||||
@ -2431,7 +2431,7 @@ made in the number or names of categories."
|
||||
;; changed, rebuild the date string.
|
||||
(when (memq what '(year month day))
|
||||
(setq ndate
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
;; Needed by calendar-date-display-form.
|
||||
((year year)
|
||||
(monthname monthname)
|
||||
@ -4658,7 +4658,7 @@ strings built using the default value of
|
||||
(defun todo-convert-legacy-date-time ()
|
||||
"Return converted date-time string.
|
||||
Helper function for `todo-convert-legacy-files'."
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
((year (match-string 1))
|
||||
(month (match-string 2))
|
||||
(monthname (calendar-month-name (string-to-number month) t))
|
||||
@ -6036,7 +6036,7 @@ indicating an unspecified month, day, or year.
|
||||
|
||||
When ARG is `day', non-nil arguments MO and YR determine the
|
||||
number of the last the day of the month."
|
||||
(calendar-dlet*
|
||||
(calendar-dlet
|
||||
(year monthname month day dayname) ;Needed by calendar-date-display-form.
|
||||
(when (or (not arg) (eq arg 'year))
|
||||
(while (if (natnump year) (< year 1) (not (eq year '*)))
|
||||
|
@ -2001,10 +2001,10 @@ all symbols are bound before any of the VALUEFORMs are evalled."
|
||||
(t `(let* ,(nreverse seqbinds) ,nbody))))))
|
||||
|
||||
(defmacro dlet (binders &rest body)
|
||||
"Like `let*' but using dynamic scoping."
|
||||
"Like `let' but using dynamic scoping."
|
||||
(declare (indent 1) (debug let))
|
||||
;; (defvar FOO) only affects the current scope, but in order for
|
||||
;; this not to affect code after the `let*' we need to create a new scope,
|
||||
;; this not to affect code after the main `let' we need to create a new scope,
|
||||
;; which is what the surrounding `let' is for.
|
||||
;; FIXME: (let () ...) currently doesn't actually create a new scope,
|
||||
;; which is why we use (let (_) ...).
|
||||
@ -2012,7 +2012,7 @@ all symbols are bound before any of the VALUEFORMs are evalled."
|
||||
,@(mapcar (lambda (binder)
|
||||
`(defvar ,(if (consp binder) (car binder) binder)))
|
||||
binders)
|
||||
(let* ,binders ,@body)))
|
||||
(let ,binders ,@body)))
|
||||
|
||||
|
||||
(defmacro with-wrapper-hook (hook args &rest body)
|
||||
|
Loading…
Reference in New Issue
Block a user