Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view the next days in org-mode's agenda?

Tags:

emacs

org-mode

It is easy to display the current day/week/month/year in the agenda (vd,vw,vm,vy), and see the previous or next period (b,f). But when you're at the end of a period, you don't see what's coming, which is annoying.

So I'm looking for a view for the next few days (say five, ten...).

like image 255
JPuydt Avatar asked Sep 06 '15 11:09

JPuydt


1 Answers

It sounds like you want to customise the weekly view, org-mode allows this. See the page: The weekly/daily agenda.

Presenting longer than 1 week

One option would be to present a fortnightly or an agenda slightly longer than one week on the "weekly" view. For a week view of 10 days so (in your hook or similar):

(setq org-agenda-span 10)

Starting view from today

The above sets ten days from last Monday, if you have the default settings. Although I suspect what you are after is not to start on a Monday at all but to start the agenda from the current day. This is achieved by:

(setq org-agenda-start-on-weekday nil)

Where (the manual says):

Non-nil means start the overview always on the specified weekday. 0 denotes Sunday, 1 denotes Monday, etc. When nil, always start on the current day. Custom commands can set this variable in the options section.

A week view spanning the current day

Another useful set-up is to span the current day showing some of the previous days in the past and the week from today, this is a combination of the settings above. For example:

(setq org-agenda-span 10
      org-agenda-start-on-weekday nil
      org-agenda-start-day "-3d")

This shows the current week from today, but also the past three days.

View Dispatch

The in view dispatch isn't that open to customization. It's much better to look to customize the main org-agenda dispatch function through the org-agenda-custom-commands variable and bind org-agenda to a global key. What I mean about this is you might have:

(add-to-list 'org-agenda-custom-commands
       '("w" "week-span"
         ((agenda "" ))
         (
          (org-agenda-overriding-header "My Week")
          (org-agenda-start-on-weekday nil)
          (org-agenda-span 10)
          (org-agenda-start-day "-3d")    
          )) t)

Which then the typical bindings means that C-caw, will give you these settings. You will notice that it appears in the dispatch menu also.

One-off view

Occasionally one might want to query an extended period temporarily, and org-agenda does take an argument so the standard C-u with a numeric is the same as extending the span. In the manual the example is 21 days: C-u21M-xorg-agendaa, or C-u21C-caa.

like image 199
andygavin Avatar answered Sep 30 '22 13:09

andygavin