emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Agenda Bulk Scatter bug


From: Carsten Dominik
Subject: Re: [O] Agenda Bulk Scatter bug
Date: Tue, 14 Jun 2011 10:51:54 +0200

On Jun 14, 2011, at 10:41 AM, Carsten Dominik wrote:

> Hi David,
> 
> On Jun 10, 2011, at 11:05 AM, David Edmondson wrote:
> 
>> * address@hidden [2011-06-10 Fri 09:20]
>>> Hi, I need a few testers:  Something very strange is going on here.
>>> 
>>> When I evaluate this form
>>> 
>>> (decode-time (days-to-time (time-to-days (current-time))))
>>> 
>>> I get a date in the year 3980.  I think this used to work.
>>> Is there anyone who has an idea what is going on here?
>> 
>> (decode-time (days-to-time (time-to-days (current-time))))
>> => (0 0 1 10 6 3980 2 t 3600)
>> 
>> With "GNU Emacs 24.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of
>> 2011-02-10 on keller, modified by Debian".
>> 
>> (time-to-days) returns the number of days since 0001-12-31bce, which
>> (days-to-time) converts into a time value. That time value is relative
>> to 0001-12-31bce, _not_ relative to 1970-01-01, which is what
>> (decode-time) is expecting.
>> 
>> Hence you end up 1970 years out.
> 
> Thank you for the analysis - the bulk scattering
> command should now again work as advertised.

OK, only after the git server starts working again.

Until then, here is the patch:

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 65f37d4..b519ff2 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8199,9 +8199,11 @@ The prefix arg is passed through to the command if 
possible."
                               (setq day-of-week 0)))))
                   ;; silently fail when try to replan a sexp entry
                   (condition-case nil
-                      (org-agenda-schedule nil
-                                           (days-to-time
-                                            (+ (org-today) distance)))
+                      (let* ((date (calendar-gregorian-from-absolute
+                                    (+ (org-today) distance)))
+                             (time (encode-time 0 0 0 (nth 1 date) (nth 0 date)
+                                                (nth 2 date))))
+                        (org-agenda-schedule nil time))
                     (error nil)))))))
 
      ((equal action ?f)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]