Re: [O] [BUG] Entries from Org code blocks appear in agenda

2014-09-09 Thread Francesco Pizzolante


Hi Nicolas,

 I noticed that entries from Org code blocks are erroneously displayed in
 the agenda.

 Here's a very simple Org example in order to reproduce it
 (my-simple-test.org):

 * Test

 #+BEGIN_SRC org ,SCHEDULED: 2014-09-04 Thu 10:00 #+END_SRC

 This is a known bug that would require to use the parser in
 org-agenda.el for a proper fix.

 Meanwhile, I wrote a workaround. Would you mind testing it (note: it
 applies on maint, probably not on master without conflicts).

Thanks for the patch.

I just applied and tested it on org-plus-contrib-20140908 from Elpa but
the workaround does not work as I can still see the erroneous headings
appearing in the agenda.

Regards,
 Francesco




[O] [BUG] Entries from Org code blocks appear in agenda

2014-09-04 Thread Francesco Pizzolante
Hi,

I noticed that entries from Org code blocks are erroneously displayed in
the agenda.

Here's a very simple Org example in order to reproduce it
(my-simple-test.org):

--8---cut here---start-8---
* Test

#+BEGIN_SRC org
,SCHEDULED: 2014-09-04 Thu 10:00
#+END_SRC
--8---cut here---end---8---

The minimal Emacs configuration used to reproduce the issue is
(my-simple-test.el):

--8---cut here---start-8---
(setq org-agenda-files '(~/my-simple-test.org))
--8---cut here---end---8---

And Emacs (my version is 24.3.1) is started with the following command:

--8---cut here---start-8---
emacs -Q -l my-simple-test.el
--8---cut here---end---8---

If you run M-x org-agenda  a, you can see that the Test entry appears
in today's agenda, which is, of course, wrong (see issue here:
http://screencast.com/t/0bhud8qPxxj).

Regards,
 Francesco



Re: [O] [BUG] Entries from Org code blocks appear in agenda

2014-09-04 Thread Nicolas Goaziou
Hello,

Francesco Pizzolante
fpz-djc/ipccudyqhejpep6iedvlejwur...@public.gmane.org writes:

 I noticed that entries from Org code blocks are erroneously displayed in
 the agenda.

 Here's a very simple Org example in order to reproduce it
 (my-simple-test.org):

 * Test

 #+BEGIN_SRC org ,SCHEDULED: 2014-09-04 Thu 10:00 #+END_SRC

This is a known bug that would require to use the parser in
org-agenda.el for a proper fix.

Meanwhile, I wrote a workaround. Would you mind testing it (note: it
applies on maint, probably not on master without conflicts).


Regards,

-- 
Nicolas Goaziou
From fad280debe2dd1cb59071f258153004f1dffd51e Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou m...@nicolasgoaziou.fr
Date: Thu, 4 Sep 2014 21:41:40 +0200
Subject: [PATCH] org-agenda: Prevent false positive SCHEDULED entries

---
 lisp/org-agenda.el | 292 ++---
 lisp/org.el|  82 +--
 2 files changed, 195 insertions(+), 179 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 4b6385b..3d6ecac 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6143,7 +6143,7 @@ an hour specification like [h]h:mm.
 		 org-scheduled-time-hour-regexp
 		   org-scheduled-time-regexp))
 	 (todayp (org-agenda-todayp date)) ; DATE bound by calendar
-	 (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
+	 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
 	 mm
 	 (deadline-position-alist
 	  (mapcar (lambda (a) (and (setq mm (get-text-property
@@ -6156,153 +6156,153 @@ an hour specification like [h]h:mm.
 	 ddays)
 (goto-char (point-min))
 (while (re-search-forward regexp nil t)
-  (catch :skip
-	(org-agenda-skip)
-	(setq s (match-string 1)
-	  txt nil
-	  pos (1- (match-beginning 1))
-	  todo-state (save-match-data (org-get-todo-state))
-	  show-all (or (eq org-agenda-repeating-timestamp-show-all t)
-			   (member todo-state
-   org-agenda-repeating-timestamp-show-all))
-	  d2 (org-time-string-to-absolute
-		  s d1 'past show-all (current-buffer) pos)
-	  diff (- d2 d1)
-	  warntime (get-text-property (point) 'org-appt-warntime))
-	(setq pastschedp (and todayp ( diff 0)))
-	(setq did-habit-check-p nil)
-	(setq suppress-delay
-	  (let ((ds (and org-agenda-skip-scheduled-delay-if-deadline
-			 (let ((item (buffer-substring (point-at-bol) (point-at-eol
-			   (save-match-data
- (and (string-match
-   org-deadline-time-regexp item)
-  (match-string 1 item)))
-		(cond
-		 ((not ds) nil)
-		 ;; The current item has a deadline date (in ds), so
-		 ;; evaluate its delay time.
-		 ((integerp org-agenda-skip-scheduled-delay-if-deadline)
-		  ;; Use global delay time.
-		  (- org-agenda-skip-scheduled-delay-if-deadline))
-		 ((eq org-agenda-skip-scheduled-delay-if-deadline
-		  'post-deadline)
-		  ;; Set delay to no later than deadline.
-		  (min (- d2 (org-time-string-to-absolute
-			  ds d1 'past show-all (current-buffer) pos))
-		   org-scheduled-delay-days))
-		 (t 0
-	(setq ddays (if suppress-delay
-			(let ((org-scheduled-delay-days suppress-delay))
-			  (org-get-wdays s t t))
-		  (org-get-wdays s t)))
-	;; Use a delay of 0 when there is a repeater and the delay is
-	;; of the form --3d
-	(when (and (save-match-data (string-match --[0-9]+[hdwmy] s))
-		   ( (org-time-string-to-absolute s)
-		  (org-time-string-to-absolute
-		   s d2 'past nil (current-buffer) pos)))
-	  (setq ddays 0))
-	;; When to show a scheduled item in the calendar:
-	;; If it is on or past the date.
-	(when (or (and ( ddays 0) (= diff (- ddays)))
-		  (and (zerop ddays) (= diff 0))
-		  (and ( (+ diff ddays) 0)
-		   ( (abs diff) org-scheduled-past-days)
-		   (and todayp (not org-agenda-only-exact-dates)))
-		  ;; org-is-habit-p uses org-entry-get, which is expansive
-		  ;; so we go extra mile to only call it once
-		  (and todayp
-		   (boundp 'org-habit-show-all-today)
-		   org-habit-show-all-today
-		   (setq did-habit-check-p t)
-		   (setq habitp (and (functionp 'org-is-habit-p)
-	 (org-is-habit-p)
-	  (save-excursion
-	(setq donep (member todo-state org-done-keywords))
-	(if (and donep
-		 (or org-agenda-skip-scheduled-if-done
-			 (not (= diff 0))
-			 (and (functionp 'org-is-habit-p)
-			  (org-is-habit-p
-		(setq txt nil)
-	  (setq habitp (if did-habit-check-p habitp
+  (let ((s (save-match-data (org-entry-get (point) SCHEDULED
+	(when s
+	  (catch :skip
+	(org-agenda-skip)
+	(setq txt nil
+		  pos (1- (match-beginning 1))
+		  todo-state (save-match-data (org-get-todo-state))
+		  show-all (or (eq org-agenda-repeating-timestamp-show-all t)
+			   (member todo-state
+   org-agenda-repeating-timestamp-show-all))
+		  d2 (org-time-string-to-absolute
+		  s d1 'past show-all (current-buffer) pos)
+		  diff (- d2 d1)
+		  warntime