all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Make today's deadlines "close" without lead time
@ 2016-06-01  5:57 Don March
  2016-06-02  8:12 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Don March @ 2016-06-01  5:57 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-04 19:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01  5:57 [PATCH] Make today's deadlines "close" without lead time Don March
2016-06-02  8:12 ` Nicolas Goaziou
2016-06-03  7:17   ` Don March
2016-06-04 19:30     ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.