emacs-orgmode@gnu.org archives
 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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2013-02-04 22:45 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> 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"...

Please make sure the change is backward compatible so that users don't
have to change the value of their `org-agenda-deadline-leaders'
(i.e. simply fall back on (nth 1 ...) when (nth 2 ...) returns nil.

Thanks,

-- 
 Bastien

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-04 22:45 ` Bastien
@ 2013-02-27 13:56   ` Bastien
  2013-02-28  8:17     ` Sebastien Vauban
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2013-02-27 13:56 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hi Sébastien,

Bastien <bzg@altern.org> writes:

>> 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"...
>
> Please make sure the change is backward compatible so that users don't
> have to change the value of their `org-agenda-deadline-leaders'
> (i.e. simply fall back on (nth 1 ...) when (nth 2 ...) returns nil.

I finally added this, with a slightly different patch:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=c8c991e

Thanks for the suggestion,

-- 
 Bastien

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-27 13:56   ` Bastien
@ 2013-02-28  8:17     ` Sebastien Vauban
  2013-02-28  8:29       ` Bastien
  2013-02-28  8:30       ` Bastien
  0 siblings, 2 replies; 13+ messages in thread
From: Sebastien Vauban @ 2013-02-28  8:17 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Bastien,

Bastien wrote:
> Hi Sébastien,
>
> Bastien <bzg-whniv8GeeGkdnm+yROfE0A@public.gmane.org> writes:
>
>>> 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"...
>>
>> Please make sure the change is backward compatible so that users don't
>> have to change the value of their `org-agenda-deadline-leaders'
>> (i.e. simply fall back on (nth 1 ...) when (nth 2 ...) returns nil.
>
> I finally added this, with a slightly different patch:
> http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=c8c991e

Nice...

Though, one question: why did you change the spacing (and, in fact, the width)
of the leaders?

--8<---------------cut here---------------start------------->8---
-(defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ")
+(defcustom org-agenda-scheduled-leaders '(" Scheduled: " "Sched.%3dx: ")
   "Text preceding scheduled items in the agenda view.

(...)

-(defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: ")
+(defcustom org-agenda-deadline-leaders '("  Deadline: " " In %3d d.: " "%3d d. ago: ")
--8<---------------cut here---------------end--------------->8---

> Thanks for the suggestion,

Thanks as well ;-)

Best regards,
  Seb

PS- Another question: some time ago, there was a ML with all the commits done
on Org. This seems to have disappeared (at least from Gmane). A reason for
that, or an alternative?

-- 
Sebastien Vauban

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  8:17     ` Sebastien Vauban
@ 2013-02-28  8:29       ` Bastien
  2013-02-28  9:21         ` Sebastien Vauban
  2013-02-28  8:30       ` Bastien
  1 sibling, 1 reply; 13+ messages in thread
From: Bastien @ 2013-02-28  8:29 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: OrgMode ML

Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Though, one question: why did you change the spacing (and, in fact, the width)
> of the leaders?
>
> -(defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ")
> +(defcustom org-agenda-scheduled-leaders '(" Scheduled: " "Sched.%3dx: ")
>    "Text preceding scheduled items in the agenda view.
>
> (...)
>
> -(defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: ")
> +(defcustom org-agenda-deadline-leaders '("  Deadline: " " In %3d d.: " "%3d d. ago: ")

For the change in "Scheduled:" and "Deadline:" it's because I
think it's cleaner to align them on the right, like the "Sched."
and "In %3d.:" strings.

For the change in the width (from 11 to 12), it's because I
wanted to correctly display "%3d d. ago: ", not %2d d. ago: ",
so that now any string with a warning delay more than 100 will
be correctly displayed.  Before, we allowed 100+ days for the
future deadlines, but not for past scheduled items (i.e. they
were not aligned properly.)

I feel the change is not too intrusive.

Best,

-- 
 Bastien

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  8:17     ` Sebastien Vauban
  2013-02-28  8:29       ` Bastien
@ 2013-02-28  8:30       ` Bastien
  2013-02-28  9:42         ` Sebastien Vauban
  2013-02-28  9:48         ` Andreas Leha
  1 sibling, 2 replies; 13+ messages in thread
From: Bastien @ 2013-02-28  8:30 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: OrgMode ML

Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> PS- Another question: some time ago, there was a ML with all the commits done
> on Org. This seems to have disappeared (at least from Gmane). A reason for
> that, or an alternative?

I can't remember of such a mailing list.

You can subscribe to the RSS feed from
http://orgmode.org/cgit.cgi/org-mode.git/

And to the dedicated newsgroup on gwene.org:
gwene.org.org-mode.git

-- 
 Bastien

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  8:29       ` Bastien
@ 2013-02-28  9:21         ` Sebastien Vauban
  2013-02-28  9:29           ` Bastien
  0 siblings, 1 reply; 13+ messages in thread
From: Sebastien Vauban @ 2013-02-28  9:21 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Bastien,

Bastien wrote:
> "Sebastien Vauban" writes:
>
>> Though, one question: why did you change the spacing (and, in fact, the width)
>> of the leaders?
>>
>> -(defcustom org-agenda-scheduled-leaders '("Scheduled: " "Sched.%2dx: ")
>> +(defcustom org-agenda-scheduled-leaders '(" Scheduled: " "Sched.%3dx: ")
>>    "Text preceding scheduled items in the agenda view.
>>
>> (...)
>>
>> -(defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: ")
>> +(defcustom org-agenda-deadline-leaders '("  Deadline: " " In %3d d.: " "%3d d. ago: ")
>
> For the change in "Scheduled:" and "Deadline:" it's because I think it's
> cleaner to align them on the right, like the "Sched." and "In %3d.:"
> strings.

I don't mind, I customize them anyway ;-)

> For the change in the width (from 11 to 12), it's because I wanted to
> correctly display "%3d d. ago: ", not %2d d. ago: ", so that now any string
> with a warning delay more than 100 will be correctly displayed. Before, we
> allowed 100+ days for the future deadlines, but not for past scheduled items
> (i.e. they were not aligned properly.)
>
> I feel the change is not too intrusive.

I think the change of width can impact people who customize a bit the look of
their agenda, and rely upong *all* the leaders to be of width 11. That was the
motivation for my other patch, about clocking info (to make it go into a
11-char slot).

Let's see how people react to that -- or if some are impacted.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  9:21         ` Sebastien Vauban
@ 2013-02-28  9:29           ` Bastien
  2013-03-24 22:12             ` Matt Lundin
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2013-02-28  9:29 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: OrgMode ML

Hi Sébastien,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> I think the change of width can impact people who customize a bit the look of
> their agenda, and rely upong *all* the leaders to be of width 11. That was the
> motivation for my other patch, about clocking info (to make it go into a
> 11-char slot).

The thread about your other patch is still open, see my last reply.

Also, a width of 12 should make it easier to fix alignment issues,
so feel free to have a go and fix the ones that disturb you.  Please
remember not every user has a 3k configuration file, so implementing
TRT with emacs -Q is highly recommended here :)

-- 
 Bastien

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  8:30       ` Bastien
@ 2013-02-28  9:42         ` Sebastien Vauban
  2013-02-28  9:48         ` Andreas Leha
  1 sibling, 0 replies; 13+ messages in thread
From: Sebastien Vauban @ 2013-02-28  9:42 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Bastien,

Bastien wrote:
> Sebastien Vauban writes:
>
>> PS- Another question: some time ago, there was a ML with all the commits done
>> on Org. This seems to have disappeared (at least from Gmane). A reason for
>> that, or an alternative?
>
> I can't remember of such a mailing list.
>
> You can subscribe to the RSS feed from
> http://orgmode.org/cgit.cgi/org-mode.git/
>
> And to the dedicated newsgroup on gwene.org:
> gwene.org.org-mode.git

That must be it: `org-mode.git', which I accessed from Gmane. Thanks.

It seems there are now 2 redundants such groups:

- nntp+gmane:gwene.cz.or.repo.w.org-mode.git
- nntp+gmane:gwene.org.org-mode.git

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  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
  1 sibling, 1 reply; 13+ messages in thread
From: Andreas Leha @ 2013-02-28  9:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi Bastien,

Bastien <bzg@altern.org> writes:

[ ... ]

>
> You can subscribe to the RSS feed from
> http://orgmode.org/cgit.cgi/org-mode.git/

Sorry for hijacking this thread, and sorry for my ignorance.  But where
can I find this RSS feed?

[ ... ]

Regards,
Andreas

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  9:48         ` Andreas Leha
@ 2013-02-28  9:55           ` Sebastien Vauban
  0 siblings, 0 replies; 13+ messages in thread
From: Sebastien Vauban @ 2013-02-28  9:55 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Andreas,

Andreas Leha wrote:
> Bastien <bzg-whniv8GeeGkdnm+yROfE0A@public.gmane.org> writes:
>> You can subscribe to the RSS feed from
>> http://orgmode.org/cgit.cgi/org-mode.git/
>
> Sorry for hijacking this thread, and sorry for my ignorance.  But where
> can I find this RSS feed?

You can find the group on Gmane (available, then, by NNTP at least).

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-02-28  9:29           ` Bastien
@ 2013-03-24 22:12             ` Matt Lundin
  2013-03-25  5:57               ` Bastien
  0 siblings, 1 reply; 13+ messages in thread
From: Matt Lundin @ 2013-03-24 22:12 UTC (permalink / raw)
  To: Bastien; +Cc: OrgMode ML, Sebastien Vauban

Bastien <bzg@altern.org> writes:

> "Sebastien Vauban"
> <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>
>> I think the change of width can impact people who customize a bit the look of
>> their agenda, and rely upong *all* the leaders to be of width 11. That was the
>> motivation for my other patch, about clocking info (to make it go into a
>> 11-char slot).
>
> The thread about your other patch is still open, see my last reply.
>
> Also, a width of 12 should make it easier to fix alignment issues,
> so feel free to have a go and fix the ones that disturb you.  Please
> remember not every user has a 3k configuration file, so implementing
> TRT with emacs -Q is highly recommended here :)

I just upgraded org-mode for the first time in a while and found these
new default settings for deadline and scheduled leaders somewhat
disorienting. 

A 12-char width causes misalignment with a sample file and emacs -Q.
(See output below).

Here is an example of the new default behavior with emacs -Q

--8<---------------cut here---------------start------------->8---
Day-agenda (W12):
Sunday     24 March 2013
               8:00...... ----------------
  test:       10:00......  Scheduled:  TODO Scheduled at a time
  test:       10:00...... An appointment
              10:00...... ----------------
              12:00...... ----------------
              14:00...... ----------------
              16:00...... ----------------
              16:59...... now - - - - - - - - - - - - - - - - - - - - - - - - -
              18:00...... ----------------
              20:00...... ----------------
  test:       Sched.  3x:  TODO A scheduled item
  test:        Scheduled:  TODO Another scheduled item
  test:         3 d. ago:  TODO An overdue item
  test:        In   2 d.:  Deadline
                          ^ 
                          Note the extra space here
--8<---------------cut here---------------end--------------->8---

And here is an example of the old default behavior (11 char. spacing):

--8<---------------cut here---------------start------------->8---
Day-agenda (W12):
Sunday     24 March 2013
               8:00...... ----------------
  test:       10:00...... Scheduled:  TODO Scheduled at a time
  test:       10:00...... An appointment
              10:00...... ----------------
              12:00...... ----------------
              14:00...... ----------------
              16:00...... ----------------
              17:06...... now - - - - - - - - - - - - - - - - - - - - - - - - -
              18:00...... ----------------
              20:00...... ----------------
  test:       Sched. 3x:  TODO A scheduled item
  test:       Scheduled:  TODO Another scheduled item
  test:       In  -3 d.:  TODO An overdue item
  test:       In   2 d.:  Deadline
--8<---------------cut here---------------end--------------->8---

> For the change in "Scheduled:" and "Deadline:" it's because I think
> it's cleaner to align them on the right, like the "Sched." and "In
> %3d.:" strings.

FWIW, I find the old default much cleaner and easier to scan visually. I
know this can be customized, but might I suggest that we revert the
default to 11-characters and left aligned text?

Best,
Matt

P.S. Thanks, as always, Bastien for all the amazing work you've been
doing as maintainer!

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

* Re: [PATCH] Add a different prefix for past deadlines in the agenda view
  2013-03-24 22:12             ` Matt Lundin
@ 2013-03-25  5:57               ` Bastien
  0 siblings, 0 replies; 13+ messages in thread
From: Bastien @ 2013-03-25  5:57 UTC (permalink / raw)
  To: Matt Lundin; +Cc: OrgMode ML, Sebastien Vauban

Hi Matt,

Matt Lundin <mdl@imapmail.org> writes:

> A 12-char width causes misalignment with a sample file and emacs -Q.
> (See output below).

Indeed -- I fixed this, we're back to 11 chars.

Thanks for reporting this and great to have you back :)

-- 
 Bastien

^ permalink raw reply	[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 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).