summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2014-12-23 12:22:16 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2014-12-23 12:22:16 +0100
commitc6d9a4ec22ff59928e05debeb27139270f293526 (patch)
tree3ccddd0b720132a2e983093a80302a88c82012a1
parentf0a13a09d84bb12d70c9c5a4a3409c5bad434971 (diff)
downloadorg-mode-c6d9a4ec22ff59928e05debeb27139270f293526.tar.gz
Fix false positive SCHEDULED lines in sparse tree
* lisp/org.el (org-check-before-date, org-check-after-date, org-check-dates-range): Make sure we're really at a timestamp before validating the entry. Reported-by: James Harkins <jamshark70@qq.com> <http://permalink.gmane.org/gmane.emacs.orgmode/93126>
-rwxr-xr-xlisp/org.el42
1 files changed, 26 insertions, 16 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 02c7a82..a2096ba 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17289,9 +17289,13 @@ both scheduled and deadline timestamps."
(let ((case-fold-search nil)
(regexp (org-re-timestamp org-ts-type))
(callback
- (lambda () (time-less-p
- (org-time-string-to-time (match-string 1))
- (org-time-string-to-time date)))))
+ `(lambda ()
+ (and ,(if (memq org-ts-type '(active inactive all))
+ '(eq (org-element-type (org-element-context) 'timestamp))
+ '(org-at-planning-p))
+ (time-less-p
+ (org-time-string-to-time (match-string 1))
+ (org-time-string-to-time date))))))
(message "%d entries before %s"
(org-occur regexp nil callback) date)))
@@ -17301,10 +17305,13 @@ both scheduled and deadline timestamps."
(let ((case-fold-search nil)
(regexp (org-re-timestamp org-ts-type))
(callback
- (lambda () (not
- (time-less-p
- (org-time-string-to-time (match-string 1))
- (org-time-string-to-time date))))))
+ `(lambda ()
+ (and ,(if (memq org-ts-type '(active inactive all))
+ '(eq (org-element-type (org-element-context) 'timestamp))
+ '(org-at-planning-p))
+ (not (time-less-p
+ (org-time-string-to-time (match-string 1))
+ (org-time-string-to-time date)))))))
(message "%d entries after %s"
(org-occur regexp nil callback) date)))
@@ -17315,15 +17322,18 @@ both scheduled and deadline timestamps."
(let ((case-fold-search nil)
(regexp (org-re-timestamp org-ts-type))
(callback
- (lambda ()
- (let ((match (match-string 1)))
- (and
- (not (time-less-p
- (org-time-string-to-time match)
- (org-time-string-to-time start-date)))
- (time-less-p
- (org-time-string-to-time match)
- (org-time-string-to-time end-date)))))))
+ `(lambda ()
+ (let ((match (match-string 1)))
+ (and
+ ,(if (memq org-ts-type '(active inactive all))
+ '(eq (org-element-type (org-element-context) 'timestamp))
+ '(org-at-planning-p))
+ (not (time-less-p
+ (org-time-string-to-time match)
+ (org-time-string-to-time start-date)))
+ (time-less-p
+ (org-time-string-to-time match)
+ (org-time-string-to-time end-date)))))))
(message "%d entries between %s and %s"
(org-occur regexp nil callback) start-date end-date)))