From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: [PATCH] Add a different prefix for past deadlines in the agenda view Date: Mon, 04 Feb 2013 22:58:19 +0100 Message-ID: <861ucvrbb8.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org 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 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