emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] dates before 1970


From: Carsten Dominik
Subject: Re: [O] dates before 1970
Date: Sun, 13 Mar 2011 08:39:13 +0100

Hi everyone,

On 11.3.2011, at 09:31, Bastien wrote:

> Hi,
> 
> Nick Dokos <address@hidden> writes:
> 
>> So I'd guess raising an exception might be the simplest way to deal with
>> this. Here's a patch to try out:
> 
> This patch has side-effects that Carsten have been recently exploring a
> bit.  Those side-effects seem to depend on how Emacs has been compiled.
> 
> For now it's best to stick to this restriction.

I am attaching a patch which tries to implement some kind of a
solution for this problem.  The patch introduces a new variable
which will allow you to use dates outside the safe range 1970-2037
once you have convinced yourself that all Emacs implementation you
are likely to use now and in the future will support the extended
range.  To be clear, I do not recommend to make use of this, the danger
that you will find yourself on a system where this issue is not
resolved is not negligible.  That is also why I would recommend
the default `t' for this variable, and why I will continue to use diary-sexp
dates for the few dates where I need a greater range.

The patch also introduces a warning with a beep when Org has forced the year,
which, I think, was really the main concern in this thread.

Here is the docstring of the new variable - it explains what is going on.

(defcustom org-read-date-force-compatible-dates t
  "Should date/time prompt force dates that are guaranteed to work in Emacs?

Depending on the system Emacs is running on, certain dates cannot
be represented with the type used internally to represent time.
Dates between 1970-1-1 and 2038-1-1 can always be represented
correctly.  Some systems allow for earlier dates, some for later,
some for both.  One way to find out it to insert any date into an
Org buffer, putting the cursor on the year and hitting S-up and
S-down to test the range.

When this variable is set to t, the date/time prompt will not let
you specify dates outside the 1970-2037 range, so it is certain that
these dates will work in whatever version of Emacs you are
running, and also that you can move a file from one Emacs implementation
to another.  WHenever Org is forcing the year for you, it will display
a message and beep.

When this variable is nil, Org will check if the date is
representable in the specific Emacs implementation you are using.
If not, it will force a year, usually the current year, and beep
to remind you.  Currently this setting is not recommended because
the likelihood that you will open your Org files in an Emacs that
has limited date range is not negligible.

A workaround for this problem is to use diary sexp dates for time
stamps outside of this range."
  :group 'org-time
  :type 'boolean)



Attachment: 0001-Improve-handling-of-years-with-limitations-on-repres.patch
Description: Binary data



reply via email to

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