* [PATCH] fix appointment warn time
@ 2013-04-26 16:17 Ivan Kanis
2013-04-26 17:01 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-04-26 16:17 UTC (permalink / raw)
To: org mode
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
It seemed to be a boundary error. (point) was at the end of the
timestamp which doesn't hold the org-appt-warntime property.
foo.org illustrate what I have seen. Evaling the get-property sexp
returns nil.
The patch adds a function that goes at the beginning of the header to
get the property. As a bonus it turns the string into a number.
Please let me know if the patch is accepted or needs improvement.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: warntime.diff --]
[-- Type: text/x-patch, Size: 2005 bytes --]
diff --git a/emacs/org/org-agenda.el b/emacs/org/org-agenda.el
index 631c6d0..a826b26 100644
--- a/emacs/org/org-agenda.el
+++ b/emacs/org/org-agenda.el
@@ -5425,6 +5425,14 @@ the documentation of `org-diary'."
(org-end-of-subtree 'invisible))))
(nreverse ee)))
+(defun org-agenda-get-warntime ()
+ "Return warn time number when the property exists."
+ (save-excursion
+ (org-back-to-heading t)
+ (let ((warntime (get-text-property (point) 'org-appt-warntime)))
+ (when warntime
+ (string-to-number warntime)))))
+
(defun org-agenda-todo-custom-ignore-p (time n)
"Check whether timestamp is farther away than n number of days.
This function is invoked if `org-agenda-todo-ignore-deadlines',
@@ -5570,7 +5578,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
clockp (and org-agenda-include-inactive-timestamps
(or (string-match org-clock-string tmp)
(string-match "]-+\\'" tmp)))
- warntime (get-text-property (point) 'org-appt-warntime)
+ warntime (org-agenda-get-warntime)
donep (member todo-state org-done-keywords))
(if (or scheduledp deadlinep closedp clockp
(and donep org-agenda-skip-timestamp-if-done))
@@ -5659,7 +5667,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
(memq 'agenda org-agenda-use-tag-inheritance))))
tags (org-get-tags-at nil (not inherited-tags))
todo-state (org-get-todo-state)
- warntime (get-text-property (point) 'org-appt-warntime)
+ warntime (org-agenda-get-warntime)
extra nil)
(dolist (r (if (stringp result)
@@ -6059,7 +6067,7 @@ specification like [h]h:mm."
(not (= diff 0))))
(setq txt nil)
(setq category (org-get-category)
- warntime (get-text-property (point) 'org-appt-warntime)
+ warntime (org-agenda-get-warntime)
category-pos (get-text-property (point) 'org-category-position))
(if (not (re-search-backward "^\\*+[ \t]+" nil t))
(throw :skip nil)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: foo.org --]
[-- Type: text/x-org, Size: 175 bytes --]
** TPIT with Jean-Philippe at San Francisco <2013-01-18 Fri 15:00 +1w>
:PROPERTIES:
:APPT_WARNTIME: 5
:END:
(get-text-property 71 'org-appt-warntime)
(goto-char 71)
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-26 16:17 [PATCH] fix appointment warn time Ivan Kanis
@ 2013-04-26 17:01 ` Bastien
2013-04-27 8:34 ` Ivan Kanis
0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-26 17:01 UTC (permalink / raw)
To: Ivan Kanis; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
Hi Ivan,
Ivan Kanis <banana@kanis.fr> writes:
> It seemed to be a boundary error. (point) was at the end of the
> timestamp which doesn't hold the org-appt-warntime property.
It does not hold the text property until this property has been
set. E.g., `org-agenda-prepare-buffers' sets this property.
So I'm still curious: under which circumstances do you expect
APPT_WARNTIME to have an effect while it does not?
`org-agenda-to-appt' do refresh the 'org-appt-warntime property,
so it will not appear here.
> foo.org illustrate what I have seen. Evaling the get-property sexp
> returns nil.
Yep, as expected.
> The patch adds a function that goes at the beginning of the header to
> get the property. As a bonus it turns the string into a number.
>
> Please let me know if the patch is accepted or needs improvement.
Can you try the attached patch instead?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el.patch --]
[-- Type: text/x-patch, Size: 362 bytes --]
diff --git a/lisp/org.el b/lisp/org.el
index 2bb6127..fe64f14 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9245,7 +9245,7 @@ property to set."
(save-excursion
(org-back-to-heading t)
(put-text-property
- (point-at-bol) (point-at-eol) tprop p))))))))
+ (point-at-bol) (org-end-of-subtree t t) tprop p))))))))
;;;; Link Stuff
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
--
Bastien
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-26 17:01 ` Bastien
@ 2013-04-27 8:34 ` Ivan Kanis
2013-04-27 12:02 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-04-27 8:34 UTC (permalink / raw)
To: Bastien; +Cc: org mode
April, 26 at 19:01 Bastien wrote:
>> The patch adds a function that goes at the beginning of the header to
>> get the property. As a bonus it turns the string into a number.
>>
>> Please let me know if the patch is accepted or needs improvement.
>
> Can you try the attached patch instead?
It works great and it looks less expensive. Thank you!
--
Sand fleas eating the Internet cables.
-- BOFH excuse #59
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-27 8:34 ` Ivan Kanis
@ 2013-04-27 12:02 ` Bastien
2013-04-28 8:48 ` Ivan Kanis
0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-27 12:02 UTC (permalink / raw)
To: Ivan Kanis; +Cc: org mode
Ivan Kanis <banana@kanis.fr> writes:
> April, 26 at 19:01 Bastien wrote:
>
>>> The patch adds a function that goes at the beginning of the header to
>>> get the property. As a bonus it turns the string into a number.
>>>
>>> Please let me know if the patch is accepted or needs improvement.
>>
>> Can you try the attached patch instead?
>
> It works great and it looks less expensive. Thank you!
Great -- thanks for testing this.
Still, I need to really understand what real problem it fixes...
is it because some of your functions needs to check the property
or is it during regular use of Org? Sorry if I missed this in
one of your previous message... and thanks in advance!
--
Bastien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-27 12:02 ` Bastien
@ 2013-04-28 8:48 ` Ivan Kanis
2013-04-28 8:59 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-04-28 8:48 UTC (permalink / raw)
To: Bastien; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 627 bytes --]
April, 27 at 14:02 Bastien wrote:
>> It works great and it looks less expensive. Thank you!
>
> Great -- thanks for testing this.
>
> Still, I need to really understand what real problem it fixes...
> is it because some of your functions needs to check the property
> or is it during regular use of Org? Sorry if I missed this in
> one of your previous message... and thanks in advance!
I am doing regular use of Org. Put the attached foo.org in your home
directory. Eval the progn. Pick agenda for the day.
Go to the test entry and do M-x describe-text-properties
Without your patch you should see that warntime is nil.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: foo.org --]
[-- Type: text/x-org, Size: 178 bytes --]
** TPIT with Jean-Philippe at San Francisco <2013-01-19 Fri 15:00 +1w>
:PROPERTIES:
:APPT_WARNTIME: 5
:END:
(progn
(setq org-agenda-files '("~/foo.org"))
(org-agenda))
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-28 8:48 ` Ivan Kanis
@ 2013-04-28 8:59 ` Bastien
2013-04-28 19:57 ` Ivan Kanis
0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-04-28 8:59 UTC (permalink / raw)
To: Ivan Kanis; +Cc: org mode
Ivan Kanis <banana@kanis.fr> writes:
> April, 27 at 14:02 Bastien wrote:
>
>>> It works great and it looks less expensive. Thank you!
>>
>> Great -- thanks for testing this.
>>
>> Still, I need to really understand what real problem it fixes...
>> is it because some of your functions needs to check the property
>> or is it during regular use of Org? Sorry if I missed this in
>> one of your previous message... and thanks in advance!
>
> I am doing regular use of Org. Put the attached foo.org in your home
> directory. Eval the progn. Pick agenda for the day.
>
> Go to the test entry and do M-x describe-text-properties
>
> Without your patch you should see that warntime is nil.
Mhh... I don't see this. The call to (org-agenda) in your (progn...)
will refresh the text-properties in foo.org and C-u C-x = show the
property in both the agenda and foo.org. I clearly miss something
here :/
--
Bastien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-28 8:59 ` Bastien
@ 2013-04-28 19:57 ` Ivan Kanis
2013-05-14 8:36 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-04-28 19:57 UTC (permalink / raw)
To: Bastien; +Cc: org mode
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
April, 28 at 10:59 Bastien wrote:
>> Without your patch you should see that warntime is nil.
>
> Mhh... I don't see this. The call to (org-agenda) in your (progn...)
> will refresh the text-properties in foo.org and C-u C-x = show the
> property in both the agenda and foo.org. I clearly miss something
> here :/
I tried it again on a more recent emacs (bzr from two weeks ago). Same
result. Are you sure you removed your patch? :D
I have attached a screen shot.
[-- Attachment #2: org-bug.png --]
[-- Type: image/png, Size: 26655 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-04-28 19:57 ` Ivan Kanis
@ 2013-05-14 8:36 ` Bastien
2013-05-14 11:46 ` Ivan Kanis
0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-05-14 8:36 UTC (permalink / raw)
To: Ivan Kanis; +Cc: org mode
Hi Ivan,
Ivan Kanis <banana@kanis.fr> writes:
> April, 28 at 10:59 Bastien wrote:
>
>>> Without your patch you should see that warntime is nil.
>>
>> Mhh... I don't see this. The call to (org-agenda) in your (progn...)
>> will refresh the text-properties in foo.org and C-u C-x = show the
>> property in both the agenda and foo.org. I clearly miss something
>> here :/
>
> I tried it again on a more recent emacs (bzr from two weeks ago). Same
> result. Are you sure you removed your patch? :D
Mhh... yes, I'm sure.
Can anyone else reproduce Ivan's problem?
--
Bastien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-05-14 8:36 ` Bastien
@ 2013-05-14 11:46 ` Ivan Kanis
2013-05-14 11:49 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-05-14 11:46 UTC (permalink / raw)
To: Bastien; +Cc: org mode
Le 14 Mai à 10h36, Bastien a écrit :
>> I tried it again on a more recent emacs (bzr from two weeks ago). Same
>> result. Are you sure you removed your patch? :D
>
> Mhh... yes, I'm sure.
>
> Can anyone else reproduce Ivan's problem?
Are you using bzr emacs?
--
D'autres civilisations que la nôtre ont pu, infiniment mieux que nous
ne l'avons fait, résoudre les problèmes qui se posent à l'homme.
-- Alfred Métraux
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-05-14 11:46 ` Ivan Kanis
@ 2013-05-14 11:49 ` Bastien
2013-05-14 12:10 ` Ivan Kanis
0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-05-14 11:49 UTC (permalink / raw)
To: Ivan Kanis; +Cc: org mode
Ivan Kanis <banana@kanis.fr> writes:
> Le 14 Mai à 10h36, Bastien a écrit :
>
>>> I tried it again on a more recent emacs (bzr from two weeks ago). Same
>>> result. Are you sure you removed your patch? :D
>>
>> Mhh... yes, I'm sure.
>>
>> Can anyone else reproduce Ivan's problem?
>
> Are you using bzr emacs?
Yes.
GNU Emacs 24.3.50.3 (i686-pc-linux-gnu, GTK+ Version 3.8.1) of 2013-05-12 on bzg
--
Bastien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-05-14 11:49 ` Bastien
@ 2013-05-14 12:10 ` Ivan Kanis
2013-05-14 13:20 ` Miguel Ruiz
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-05-14 12:10 UTC (permalink / raw)
To: Bastien; +Cc: org mode
Le 14 Mai à 13h49, Bastien a écrit :
>>> Can anyone else reproduce Ivan's problem?
>>
>> Are you using bzr emacs?
>
Now I recall it happens on 24.1 and bzr. Let's hope someone else can
reproduce.
--
La différence entre un bon et un mauvais architecte réside en ce que
le mauvais succombe à toutes les tentations quand le bon leur tient
tête.
-- Ludwig Wittgenstein
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-05-14 12:10 ` Ivan Kanis
@ 2013-05-14 13:20 ` Miguel Ruiz
2013-05-14 14:08 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Miguel Ruiz @ 2013-05-14 13:20 UTC (permalink / raw)
To: Ivan Kanis; +Cc: emacs-orgmode
--- El mar, 14/5/13, Ivan Kanis <banana@kanis.fr> escribió:
> De: Ivan Kanis <banana@kanis.fr>
> Asunto: Re: [O] [PATCH] fix appointment warn time
> Para: "Bastien" <bzg@gnu.org>
> CC: "org mode" <emacs-orgmode@gnu.org>
> Fecha: martes, 14 de mayo, 2013 14:10
> Le 14 Mai à 13h49, Bastien a
> écrit :
>
> >>> Can anyone else reproduce Ivan's problem?
Yes, I can. Both Emacs 24.3 with Org-mode version 7.9.4 (7.9.4-1-ga5435f-elpa) and Org-mode version 8.0.2 (release_8.0.2-71-g5a1400) exhibits the problem than Ivan reports.
For me it is solved with Bastien patch, i.e.
http://lists.gnu.org/archive/html/emacs-orgmode/2013-04/txt0omoVnE86i.txt
>
> >>
> >> Are you using bzr emacs?
> >
>
> Now I recall it happens on 24.1 and bzr. Let's hope someone
> else can
> reproduce.
> --
> La différence entre un bon et un mauvais architecte réside
> en ce que
> le mauvais succombe à toutes les tentations quand le bon
> leur tient
> tête.
>
> -- Ludwig Wittgenstein
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-05-14 13:20 ` Miguel Ruiz
@ 2013-05-14 14:08 ` Bastien
2013-05-14 15:06 ` Ivan Kanis
0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2013-05-14 14:08 UTC (permalink / raw)
To: Miguel Ruiz; +Cc: emacs-orgmode, Ivan Kanis
Hi Miguel,
Miguel Ruiz <rbenit68@yahoo.es> writes:
> Yes, I can. Both Emacs 24.3 with Org-mode version 7.9.4
> (7.9.4-1-ga5435f-elpa) and Org-mode version 8.0.2
> (release_8.0.2-71-g5a1400) exhibits the problem than Ivan reports.
>
> For me it is solved with Bastien patch, i.e.
>
> http://lists.gnu.org/archive/html/emacs-orgmode/2013-04/txt0omoVnE86i.txt
I applied this patch, thanks for confirming.
FWIW I still cannot reproduce the bug... weird.
--
Bastien
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] fix appointment warn time
2013-05-14 14:08 ` Bastien
@ 2013-05-14 15:06 ` Ivan Kanis
2013-05-14 15:18 ` Bastien
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Kanis @ 2013-05-14 15:06 UTC (permalink / raw)
To: Bastien; +Cc: Miguel Ruiz, emacs-orgmode
Le 14 Mai à 16h08, Bastien a écrit :
> Hi Miguel,
>
> Miguel Ruiz <rbenit68@yahoo.es> writes:
>
>> Yes, I can. Both Emacs 24.3 with Org-mode version 7.9.4
>> (7.9.4-1-ga5435f-elpa) and Org-mode version 8.0.2
>> (release_8.0.2-71-g5a1400) exhibits the problem than Ivan reports.
>>
>> For me it is solved with Bastien patch, i.e.
>>
>> http://lists.gnu.org/archive/html/emacs-orgmode/2013-04/txt0omoVnE86i.txt
>
> I applied this patch, thanks for confirming.
Thanks!
> FWIW I still cannot reproduce the bug... weird.
Have you tried emacs -Q ?
--
Les mots sont les fantômes des imaginations malades, au-dessus
desquels il y a la vie qu'il faut vivre sans penser aux mots.
-- Charles-Louis Philippe
J'écoute « The Mamas & the Papas - I Call Your Name ».
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-05-14 15:18 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 16:17 [PATCH] fix appointment warn time Ivan Kanis
2013-04-26 17:01 ` Bastien
2013-04-27 8:34 ` Ivan Kanis
2013-04-27 12:02 ` Bastien
2013-04-28 8:48 ` Ivan Kanis
2013-04-28 8:59 ` Bastien
2013-04-28 19:57 ` Ivan Kanis
2013-05-14 8:36 ` Bastien
2013-05-14 11:46 ` Ivan Kanis
2013-05-14 11:49 ` Bastien
2013-05-14 12:10 ` Ivan Kanis
2013-05-14 13:20 ` Miguel Ruiz
2013-05-14 14:08 ` Bastien
2013-05-14 15:06 ` Ivan Kanis
2013-05-14 15:18 ` Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).