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

5

24

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

Realgar answered 6/9, 2015 at 11:38 Comment(2)
I would suggest setting up custom views for 30, 45, 60, 90, 120 days. It's possible of course to alter the starting date, and it also possible to programmatically increase the span based on the current span. Are you seeking to programmatically increase the span or change the starting date, let's say from the 1st of the month to the 15th of the month, keeping the same span?Gonad
If you want to write a simple function, take a look at something similar: #29697256, which displays an agenda for the next weekend.Dalia
A
30

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.

Alcus answered 6/9, 2015 at 17:20 Comment(1)
I really like the hybrid third example – 10 days, starting three days ago.Pengelly
M
15

There is an easier way to do this, by adding a numeric prefix when showing the agenda view.

For example, if I want to show the next 21 days schedule. I can do: C-u 2 1 C-c a a. This will do the trick.

Monochromat answered 3/2, 2018 at 3:38 Comment(1)
This feels much more natural and emacsy to me thanks. You can actually omit the -u part, and just hit C N <command>, to repeat <command> N times.Cherriecherrita
I
11

For spacemacs, to display a 14 day agenda, you can do 1 4 SPC a o a.

1 4 can be replaced with any number.

Its answered 21/4, 2019 at 10:58 Comment(0)
M
1

You can also ask Org-agenda to view a specific month (and year as well) by adding a prefix before v m.

For example, if the current month is July, and you want to see the calendar of August, September, then type 8 v m, 9 v m.

You can also type 201808 v m, 201908 v m to see the calendar of August 2018, 2019, etc.

Microclimatology answered 31/7, 2020 at 9:54 Comment(0)
S
0

I made dhnam/agenda-move-to-prev-span and dhnam/agenda-move-to-next-span functions, which show the previous or the next span of days (code). The size of span is same with org-agenda-span.

Simmers answered 26/8, 2023 at 1:31 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.