简体   繁体   中英

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

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

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 Cc a w , 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 Cu with a numeric is the same as extending the span. In the manual the example is 21 days: Cu 2 1 Mx org-agenda a , or Cu 2 1 Cc a a .

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: Cu 2 1 Cc a a. This will do the trick.

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.

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM