emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* need: custom agenda for last 7 days
@ 2013-02-20 19:00 Subhan Tindall
  2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Subhan Tindall @ 2013-02-20 19:00 UTC (permalink / raw)
  To: Org-Mode

I have a question regarding a custom agenda report.  I've found the
variable org-agenda-span to set the number of days shown.  But, I
can't seem to some up with a way to make it start in the past.
IE I want to see all agenda items for today and the previous 6 days.
Also, can someone point me at a good tutorial for customized agendas
including all option variables & what they do? I can't seem to put my
fingers on one.
Thanks!
Subhan
'(org-agenda-custom-commands (quote (("w" "Weekly Logs" agenda ""
((org-agenda-span 8))))))


-- 
Subhan Michael Tindall | Software Developer
| smt@rentrakmail.com
RENTRAK | www.rentrak.com | NASDAQ: RENT

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

* Re: need: custom agenda for last 7 days
  2013-02-20 19:00 need: custom agenda for last 7 days Subhan Tindall
@ 2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
  2013-02-21 14:05   ` Jeremy \
  2013-02-21 16:58   ` Subhan Tindall
  2013-02-21 12:35 ` Samuel Loury
  2013-02-22  8:19 ` Bastien
  2 siblings, 2 replies; 10+ messages in thread
From: Jeremy "LeJyBy" Barbay @ 2013-02-21 11:39 UTC (permalink / raw)
  To: emacs-orgmode

Subhan Tindall <subhan.tindall <at> rentrakmail.com> writes:

> I have a question regarding a custom agenda report.  I've found the
> variable org-agenda-span to set the number of days shown.  But, I
> can't seem to some up with a way to make it start in the past.
> IE I want to see all agenda items for today and the previous 6 days.

Hi Subhan.

- Would the following serve you?
  ((org-agenda-list nil (- (org-today) 7) 6) ; 6 day agenda starting 6 days ago

I tried (and failed) to find how to define a custom command in the agenda to
this purpose, but the last function fulfilled my wish. An unexpected twist
(which you might like) is that (org-agenda-list nil (- (org-today) 7) 7) gives a
7 day agenda starting Monday of last week, rather than 7 days ago.

I hope it helps!

Many thanks to all people involved in org-mode for their good work and patience
with the "rowdy" users!

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

* Re: need: custom agenda for last 7 days
  2013-02-20 19:00 need: custom agenda for last 7 days Subhan Tindall
  2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
@ 2013-02-21 12:35 ` Samuel Loury
  2013-02-21 15:04   ` Nick Dokos
  2013-02-22  8:19 ` Bastien
  2 siblings, 1 reply; 10+ messages in thread
From: Samuel Loury @ 2013-02-21 12:35 UTC (permalink / raw)
  To: Subhan Tindall, Org-Mode

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

Subhan Tindall <subhan.tindall@rentrakmail.com> writes:

> I have a question regarding a custom agenda report.  I've found the
> variable org-agenda-span to set the number of days shown.  But, I
> can't seem to some up with a way to make it start in the past.
> IE I want to see all agenda items for today and the previous 6 days.
> Also, can someone point me at a good tutorial for customized agendas
> including all option variables & what they do? I can't seem to put my
> fingers on one.
> Thanks!
> Subhan
> '(org-agenda-custom-commands (quote (("w" "Weekly Logs" agenda ""
> ((org-agenda-span 8))))))
>
>
> -- 
> Subhan Michael Tindall | Software Developer
> | smt@rentrakmail.com
> RENTRAK | www.rentrak.com | NASDAQ: RENT
>

Hi, this is what I have

╭────
│ (defun my/org-last-week ()
│   (- (org-today) 7)
│   )
│ 
│ 
│ (add-to-list 'org-agenda-custom-commands
│ 			 '("w" "Weekly Logs"
│ 			   (
│ 				(agenda nil
│ 						(
│ 						 (org-agenda-overriding-header
│ 						  "Review for last week")
│ 						 (org-agenda-span 8)
│ 						 )
│ 						)
│ 				)
│ 			   (
│ 				(org-agenda-start-day 'my/org-last-week)
│ 				(org-agenda-start-with-clockreport-mode t)
│ 				(org-agenda-start-with-log-mode t)
│ 				(org-agenda-archives-mode t)
│ 				(org-agenda-show-log 'clockcheck)
│ 				)
│ 			   )
│ 			 )
╰────
Hope it helps.
-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

* Re: need: custom agenda for last 7 days
  2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
@ 2013-02-21 14:05   ` Jeremy \
  2013-02-21 16:58   ` Subhan Tindall
  1 sibling, 0 replies; 10+ messages in thread
From: Jeremy \ @ 2013-02-21 14:05 UTC (permalink / raw)
  To: emacs-orgmode

     Subhan: here is a fonction you can use to generate your weekly report:
     #+BEGIN_SRC lisp
      (defun my/weekly-report nil
        "Generate the agenda list for last 8 days with report mode on"
        (org-agenda-list nil (- (org-today) 8) 8) ; 8 day agenda starting 8 days ago
        (setq org-agenda-clockreport-mode nil)
        (org-agenda-clockreport-mode)
        )         
     #+END_SRC

     Samuel: I love your solution (much more elegant than mine!), but even with
emacs -q I get the error 
     #+BEGIN_SRC 
       org-agenda-list: Wrong type argument: number-or-marker-p, my/org-last-week
     #+END_SRC

     I am using GNU Emacs 24.3.50.1 and Org-mode version 7.9.3d.
     

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

* Re: need: custom agenda for last 7 days
  2013-02-21 12:35 ` Samuel Loury
@ 2013-02-21 15:04   ` Nick Dokos
  2013-02-21 17:19     ` Samuel Loury
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2013-02-21 15:04 UTC (permalink / raw)
  To: Samuel Loury; +Cc: Org-Mode, Subhan Tindall

Samuel Loury <konubinix@gmail.com> wrote:

> ╭────
> │ (defun my/org-last-week ()
> │   (- (org-today) 7)
> │   )
> │ 
> │ 
> │ (add-to-list 'org-agenda-custom-commands
> │ 			 '("w" "Weekly Logs"
> │ 			   (
> │ 				(agenda nil
> │ 						(
> │ 						 (org-agenda-overriding-header
> │ 						  "Review for last week")
> │ 						 (org-agenda-span 8)
> │ 						 )
> │ 						)
> │ 				)
> │ 			   (
> │ 				(org-agenda-start-day 'my/org-last-week)

I think that's wrong: there is no support afaik for this variable to have
a function value. Should that  be

 				(org-agenda-start-day (my/org-last-week))

perhaps?

Nick

> │ 				(org-agenda-start-with-clockreport-mode t)
> │ 				(org-agenda-start-with-log-mode t)
> │ 				(org-agenda-archives-mode t)
> │ 				(org-agenda-show-log 'clockcheck)
> │ 				)
> │ 			   )
> │ 			 )
> ╰────
> Hope it helps.
> -- 
> Konubinix
> GPG Key    : 7439106A
> Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

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

* Re: need: custom agenda for last 7 days
  2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
  2013-02-21 14:05   ` Jeremy \
@ 2013-02-21 16:58   ` Subhan Tindall
  1 sibling, 0 replies; 10+ messages in thread
From: Subhan Tindall @ 2013-02-21 16:58 UTC (permalink / raw)
  To: Jeremy LeJyBy; +Cc: emacs-orgmode

Actually I think the behavior of agendas is somewhat broken in this
regard - a 6 day span shows 6 days, an 8 day span shows 8 days, a 7
day span shows a weekly agenda starting on Monday.  Silently
redefining the meaning of a variable like this depending on it's value
is pretty horrible.

But thanks to everybody for the tips, I think I can work out what I
want from here!
Subhan


On Thu, Feb 21, 2013 at 3:39 AM, Jeremy "LeJyBy" <jbarbay@dcc.uchile.cl> wrote:
[SNIP]

> I tried (and failed) to find how to define a custom command in the agenda to
> this purpose, but the last function fulfilled my wish. An unexpected twist
> (which you might like) is that (org-agenda-list nil (- (org-today) 7) 7) gives a
> 7 day agenda starting Monday of last week, rather than 7 days ago.
>
> I hope it helps!
>
> Many thanks to all people involved in org-mode for their good work and patience
> with the "rowdy" users!
>
>



-- 
Subhan Michael Tindall | Software Developer
| smt@rentrakmail.com
RENTRAK | www.rentrak.com | NASDAQ: RENT

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

* Re: need: custom agenda for last 7 days
  2013-02-21 15:04   ` Nick Dokos
@ 2013-02-21 17:19     ` Samuel Loury
  0 siblings, 0 replies; 10+ messages in thread
From: Samuel Loury @ 2013-02-21 17:19 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Org-Mode, Subhan Tindall

[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

Nick Dokos <nicholas.dokos@hp.com> writes:

> Samuel Loury <konubinix@gmail.com> wrote:
>
>> ╭────
>> │ (defun my/org-last-week ()
>> │   (- (org-today) 7)
>> │   )
>> │ 
>> │ 
>> │ (add-to-list 'org-agenda-custom-commands
>> │ 			 '("w" "Weekly Logs"
>> │ 			   (
>> │ 				(agenda nil
>> │ 						(
>> │ 						 (org-agenda-overriding-header
>> │ 						  "Review for last week")
>> │ 						 (org-agenda-span 8)
>> │ 						 )
>> │ 						)
>> │ 				)
>> │ 			   (
>> │ 				(org-agenda-start-day 'my/org-last-week)
>
> I think that's wrong: there is no support afaik for this variable to have
> a function value.

Hum. You're right. I forgot I also patched the org-agenda.el code for
this to work.

> Should that  be
>
>  				(org-agenda-start-day (my/org-last-week))

That works well indeed. And does not need any patch.
Thanks for the correction.

-- 
Konubinix
GPG Key    : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE  5C36 75D2 3CED 7439 106A

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

* Re: need: custom agenda for last 7 days
  2013-02-20 19:00 need: custom agenda for last 7 days Subhan Tindall
  2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
  2013-02-21 12:35 ` Samuel Loury
@ 2013-02-22  8:19 ` Bastien
  2013-02-22  9:15   ` Xiao-Yong Jin
  2 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2013-02-22  8:19 UTC (permalink / raw)
  To: Subhan Tindall; +Cc: Org-Mode

Hi Subhan,

Subhan Tindall <subhan.tindall@rentrakmail.com> writes:

> '(org-agenda-custom-commands (quote (("w" "Weekly Logs" agenda ""
> ((org-agenda-span 8))))))

You can combine `org-agenda-span' and `org-agenda-start-day', 
which interprets negative values correctly:

'(org-agenda-custom-commands (quote (("w" "Weekly Logs" agenda ""
 ((org-agenda-span 8)
  (org-agenda-start-day -7))))))

And *yes*, we need more documentation and tutorials on this.
Help is welcome!

Best,

-- 
 Bastien

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

* Re: need: custom agenda for last 7 days
  2013-02-22  8:19 ` Bastien
@ 2013-02-22  9:15   ` Xiao-Yong Jin
  2013-02-22 12:43     ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Xiao-Yong Jin @ 2013-02-22  9:15 UTC (permalink / raw)
  To: Bastien; +Cc: Org-Mode, Subhan Tindall

I was just trying to search for this the other day.

On Feb 22, 2013, at 5:19 PM, Bastien <bzg@altern.org> wrote:

> Hi Subhan,
> 
> Subhan Tindall <subhan.tindall@rentrakmail.com> writes:
> 
>> '(org-agenda-custom-commands (quote (("w" "Weekly Logs" agenda ""
>> ((org-agenda-span 8))))))
> 
> You can combine `org-agenda-span' and `org-agenda-start-day', 
> which interprets negative values correctly:
> 
> '(org-agenda-custom-commands (quote (("w" "Weekly Logs" agenda ""
> ((org-agenda-span 8)
>  (org-agenda-start-day -7))))))

I believe you need to pass a string to =org-agenda-start-day=.

    (org-agenda-start-day "-7")

> 
> And *yes*, we need more documentation and tutorials on this.

For this variable, =org-agenda-start-day=, give a link to the document of the function =org-read-date= would be great.  I had to read through the source code to understand it.

> Help is welcome!
> 
> Best,
> 
> -- 
> Bastien
> 

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

* Re: need: custom agenda for last 7 days
  2013-02-22  9:15   ` Xiao-Yong Jin
@ 2013-02-22 12:43     ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2013-02-22 12:43 UTC (permalink / raw)
  To: Xiao-Yong Jin; +Cc: Org-Mode, Subhan Tindall

Hi Xiao-Yong,

Xiao-Yong Jin <jinxiaoyong@gmail.com> writes:

> I believe you need to pass a string to =org-agenda-start-day=.
>
>     (org-agenda-start-day "-7")

Indeed, sorry for the mistake.

> For this variable, =org-agenda-start-day=, give a link to the document of
> the function =org-read-date= would be great.  I had to read through the
> source code to understand it.

Done, thanks!

-- 
 Bastien

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

end of thread, other threads:[~2013-02-22 12:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 19:00 need: custom agenda for last 7 days Subhan Tindall
2013-02-21 11:39 ` Jeremy "LeJyBy" Barbay
2013-02-21 14:05   ` Jeremy \
2013-02-21 16:58   ` Subhan Tindall
2013-02-21 12:35 ` Samuel Loury
2013-02-21 15:04   ` Nick Dokos
2013-02-21 17:19     ` Samuel Loury
2013-02-22  8:19 ` Bastien
2013-02-22  9:15   ` Xiao-Yong Jin
2013-02-22 12:43     ` Bastien

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