emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [PATCH] Add a different prefix for past deadlines in the agenda view
Date: Mon, 04 Feb 2013 22:58:19 +0100	[thread overview]
Message-ID: <861ucvrbb8.fsf@somewhere.org> (raw)

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

             reply	other threads:[~2013-02-04 21:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 21:58 Sebastien Vauban [this message]
2013-02-04 22:45 ` [PATCH] Add a different prefix for past deadlines in the agenda view 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

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=861ucvrbb8.fsf@somewhere.org \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.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).