emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Patch: org-agenda-skip-deadline-prewarning-if-scheduled prior to sch


From: Justus-dev
Subject: [O] Patch: org-agenda-skip-deadline-prewarning-if-scheduled prior to scheduled date
Date: Wed, 17 Oct 2012 09:56:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi,

I have scratched an itch:

I would like not to be bothered with TODOs that have a scheduled date in
the future.  However, as of that scheduled date I would like their
deadline prewarnings to appear in the agenda, just like non-scheduled
TODOs.  I do not see how to achieve this behavior using the existing
org-mode facilities (I run the org shipped with Emacs 24.2.1).

I solved this by adding an option to
org-agenda-skip-deadline-prewarning-if-scheduled that behaves like
setting it to an integer value (custom deadline warning lead time), but
sets it to the number of days between scheduled and deadline dates.  As
a result, deadline warnings prior to the scheduled date are eliminated.

I attach two diffs: presched-24.2.1.diff reflects the change against
org-agenda.el from Emacs 24.2.1 I developed and tested;
presched-latest.diff (almost identical) reflects the same change against
today's org-agenda.el from the org-mode git.  The latter is untested,
but I'm fairly confident it works since the changes are very localized
and do not appear to interact with differences between the two original
org-agenda.els.

Please review the patch carefully:

- In org-agenda-get-deadlines, I moved the relevant form ("(setq
  suppress-prewarning ...)") down into the middle of a long (setq ...)
  because it builds on values computed above and provides values used
  below.

- I split the long (setq ...) into three separate (setq ...)s for
  readability because all other assignments are compact while this one
  is long and complex.

- Because of this complexity I added some comments which hopefully makes
  things readable.  However, a more experienced lisp programmer may be
  able to rewrite the code such that it is crystal clear even without
  comments.

- Instead of the lead-time logic described above, a different way to
  achieve a similar effect would be to add a condition that checks
  whether the scheduled date is in the future, in which case the
  prewarning is removed unconditionally.  This would presumably be done
  by setting suppress-prewarning to 0.  I have not tried to implement
  this.  As far as I can see, this would likewise involve computing the
  difference between two dates, and the resulting code would be of about
  the same complexity, but setting the max. lead to the scheduled date
  (instead of to 0) appears more sound to me.

Here's a suggested commit message:

org-agenda: New option: skip deadline prewarning if scheduled in the future

* lisp/org-agenda.el (org-agenda-skip-deadline-prewarning-if-scheduled):
  Add an option to skip the deadline prewarning if the scheduled date is
  in the future.

Comments?

Justus

Attachment: presched-24.2.1.diff
Description: Text Data

Attachment: presched-latest.diff
Description: Text Data


reply via email to

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