all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Add a different prefix for past deadlines in the agenda view
@ 2013-02-04 21:58 Sebastien Vauban
  2013-02-04 22:45 ` Bastien
  0 siblings, 1 reply; 13+ messages in thread
From: Sebastien Vauban @ 2013-02-04 21:58 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Here's a patch to allow for a different prefix for deadline entries which are
in the past: for example, "3 d ago" instead of "In -3 d"...

Example:

--8<---------------cut here---------------start------------->8---
Day-agenda (W06):
2013-02-04 Mon __________________________________________________
                8:00...... 
               10:00...... 
               12:00...... 
               14:00...... 
               16:00...... 
               20:00...... 
               22:42...... now
  In 9 d.:     TODO [#A] Do this
  39 d. ago:   STRT Should have done this for long already
--8<---------------cut here---------------end--------------->8---

Best regards,
  Seb

From 1eaf4433dd8800126dce4209045bb524553aae2a Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
Date: Mon, 4 Feb 2013 22:49:47 +0100
Subject: [PATCH 2/2] Add a 3rd string for past deadlines

* org-agenda.el (org-agenda-get-deadlines): Add a 3rd string as the
preceding text when the deadline is already in the past.

---
 lisp/org-agenda.el |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 355a477..dd320c3 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1626,12 +1626,13 @@ These entries are added to the agenda when pressing \"[\"."
 	  (string :tag "Scheduled today     ")
 	  (string :tag "Scheduled previously")))

-(defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: ")
+(defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: "
+					 "%-2d d. ago:")
   "Text preceding deadline items in the agenda view.
-This is a list with two strings.  The first applies when the item has its
-deadline on the current day.  The second applies when it is in the past or
-in the future, it may contain %d to capture how many days away the deadline
-is (was)."
+This is a list with three strings.  The first applies when the item has its
+deadline on the current day.  The second and third apply when it is in the
+future or in the past, it may contain %d to capture how many days away the
+deadline is (was)."
   :group 'org-agenda-line-format
   :type '(list
 	  (string :tag "Deadline today   ")
@@ -6046,13 +6047,21 @@ See also the user option `org-agenda-clock-consistency-checks'."
 		  (setq txt (org-agenda-format-item
 			     (if (= diff 0)
 				 (car org-agenda-deadline-leaders)
-			       (if (functionp
-				    (nth 1 org-agenda-deadline-leaders))
-				   (funcall
-				    (nth 1 org-agenda-deadline-leaders)
-				    diff date)
-				 (format (nth 1 org-agenda-deadline-leaders)
-					 diff)))
+			       (if (> diff 0)
+				   (if (functionp
+					(nth 1 org-agenda-deadline-leaders))
+				       (funcall
+					(nth 1 org-agenda-deadline-leaders)
+					diff date)
+				     (format (nth 1 org-agenda-deadline-leaders)
+					     diff))
+				 (if (functionp
+				      (nth 2 org-agenda-deadline-leaders))
+				     (funcall
+				      (nth 2 org-agenda-deadline-leaders)
+				      (abs diff) date)
+				   (format (nth 2 org-agenda-deadline-leaders)
+					   (abs diff)))))
 			     head level category tags
 			     (if (not (= diff 0)) nil timestr)))))
 	      (when txt
--
1.7.9

-- 
Sebastien Vauban

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

end of thread, other threads:[~2013-03-25  6:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04 21:58 [PATCH] Add a different prefix for past deadlines in the agenda view Sebastien Vauban
2013-02-04 22:45 ` Bastien
2013-02-27 13:56   ` Bastien
2013-02-28  8:17     ` Sebastien Vauban
2013-02-28  8:29       ` Bastien
2013-02-28  9:21         ` Sebastien Vauban
2013-02-28  9:29           ` Bastien
2013-03-24 22:12             ` Matt Lundin
2013-03-25  5:57               ` Bastien
2013-02-28  8:30       ` Bastien
2013-02-28  9:42         ` Sebastien Vauban
2013-02-28  9:48         ` Andreas Leha
2013-02-28  9:55           ` Sebastien Vauban

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.