org.el: Fix bug from switch to lexical binding

* lisp/org.el (org-check-dates-range): Fix a bug introduces with the
  switch to lexical binding in commit
  1f49e9fdfd.

This change fixed the following bug:  C-c \ D leads to error message "Symbol's value as variable is void: start-date".

TINYCHANGE
This commit is contained in:
Michael Strey 2016-04-08 14:03:30 +02:00 committed by Nicolas Goaziou
parent ea98632e3b
commit 0fac70ea89
1 changed files with 13 additions and 12 deletions

View File

@ -17476,18 +17476,19 @@ both scheduled and deadline timestamps."
(let ((case-fold-search nil) (let ((case-fold-search nil)
(regexp (org-re-timestamp org-ts-type)) (regexp (org-re-timestamp org-ts-type))
(callback (callback
`(lambda () (let ((type org-ts-type))
(let ((match (match-string 1))) (lambda ()
(and (let ((match (match-string 1)))
,(if (memq org-ts-type '(active inactive all)) (and
'(eq (org-element-type (org-element-context)) 'timestamp) (if (memq type '(active inactive all))
'(org-at-planning-p)) (eq (org-element-type (org-element-context)) 'timestamp)
(not (time-less-p (org-at-planning-p))
(org-time-string-to-time match) (not (time-less-p
(org-time-string-to-time start-date))) (org-time-string-to-time match)
(time-less-p (org-time-string-to-time start-date)))
(org-time-string-to-time match) (time-less-p
(org-time-string-to-time end-date))))))) (org-time-string-to-time match)
(org-time-string-to-time end-date))))))))
(message "%d entries between %s and %s" (message "%d entries between %s and %s"
(org-occur regexp nil callback) start-date end-date))) (org-occur regexp nil callback) start-date end-date)))