emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Don March <don@ohspite.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Make today's deadlines "close" without lead time
Date: Wed, 1 Jun 2016 01:57:55 -0400	[thread overview]
Message-ID: <CABSfPEqDgVC-OVCYFir5q7x9rSC5qY69xWRQJK=JVidEa_xMTQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

This patch makes a very small change to the function that determines if a
timestamp is close to the current day, which is used for showing/hiding items in
agenda views.

Under current behavior, a deadline of today is close only if it has some amount
of lead time. If your date is 2016-06-01, the following statements evaluate to
nil:
#+BEGIN_SRC emacs-lisp
(org-deadline-close "2016-06-01 Wed -0d") ;; but this is today!
(org-deadline-close "2016-06-02 Wed -1d")
#+END_SRC

One effect of this is that if you set =org-agenda-todo-ignore-deadlines= to
=far= and generate the TODO list agenda view (C-c a t), then items only appear
if you are one day past the point at which they should appear. For example, the
following item does not show up in my current TODO list:
#+BEGIN_EXAMPLE
* TODO due today, no lead time
DEADLINE: <2016-06-01 -0d>
#+END_EXAMPLE

[-- Attachment #2: 0001-Make-today-s-deadlines-close-without-lead-time.patch --]
[-- Type: text/x-patch, Size: 1023 bytes --]

From 5401da2076b9de890fbf086e472c09c3f0a66fdf Mon Sep 17 00:00:00 2001
From: Don March <don@ohspite.net>
Date: Wed, 1 Jun 2016 00:05:12 -0400
Subject: [PATCH] Make today's deadlines "close" without lead time

* org.el (org-deadline-close): A timestamp is close if the days between
  now and the timestamp are less then or equal to the days of lead time.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 680086d..fb9e101 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17479,7 +17479,7 @@ If SECONDS is non-nil, return the difference in seconds."
 (defun org-deadline-close (timestamp-string &optional ndays)
   "Is the time in TIMESTAMP-STRING close to the current date?"
   (setq ndays (or ndays (org-get-wdays timestamp-string)))
-  (and (< (org-time-stamp-to-now timestamp-string) ndays)
+  (and (<= (org-time-stamp-to-now timestamp-string) ndays)
        (not (org-entry-is-done-p))))
 
 (defun org-get-wdays (ts &optional delay zero-delay)
-- 
2.8.1


             reply	other threads:[~2016-06-01  5:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01  5:57 Don March [this message]
2016-06-02  8:12 ` [PATCH] Make today's deadlines "close" without lead time Nicolas Goaziou
2016-06-03  7:17   ` Don March
2016-06-04 19:30     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABSfPEqDgVC-OVCYFir5q7x9rSC5qY69xWRQJK=JVidEa_xMTQ@mail.gmail.com' \
    --to=don@ohspite.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).