org-agenda: rework ndays and span handling
commit0d0edd6d21ade8e8617c51e3594ea4e87040e05f
authorJulien Danjou <julien@danjou.info>
Fri, 3 Dec 2010 16:50:50 +0000 (3 16:50 +0000)
committerCarsten Dominik <carsten.dominik@gmail.com>
Fri, 3 Dec 2010 12:07:31 +0000 (3 13:07 +0100)
tree2092eb7176f69bd27d179f980cea931d7bac5e72
parentc3b2977de6d333156f0926b52314f6b91c32e220
org-agenda: rework ndays and span handling

* org-agenda.el (org-agenda-custom-commands-local-options):
Allow org-agenda-span to be a symbol.
(org-agenda-ndays): Make obsolete.
(org-agenda-span): New variable superseding org-agenda-ndays.
(org-agenda-menu): Use org-agenda-current-span.
(org-agenda-current-span): New local variable storing current
span.
(org-agenda-list): Take a span instead of ndays as argument.
This function is now responsible for computing the ndays based
on span.
(org-agenda-ndays-to-span): Return span only if number of days
really matches.
(org-agenda-span-to-ndays): New function.
(org-agenda-manipulate-query): Use org-agenda-compute-starting-span.
(org-agenda-goto-today): Use org-agenda-compute-starting-span.
(org-agenda-later): Do not give compute a new span, use the
current one.
(org-agenda-day-view, org-agenda-week-view)
(org-agenda-month-view, org-agenda-year-view): Stop touching
org-agenda-ndays.
(org-agenda-change-time-span): Only compute starting-span.
(org-agenda-compute-starting-span): New function derived from
the old org-agenda-compute-time-span.
(org-agenda-set-mode-name): Compute mode based on
org-agenda-current-span.
(org-agenda-span-name): New function.

* org-mouse.el: Replace Replace org-agenda-ndays by
org-agenda-current-span.

* org.texi, orgguide.texi: Replace org-agenda-ndays by
org-agenda-span. Add a paragraph about org-agenda-span and say that
org-agenda-ndays is now deprecated.

This patch is pretty huge, so I'll give a bit of context about it.

I'm weird, but I used org-agenda-ndays set to 14. Unfortunately, this
settings was interpreted as a month view. Pressing 'f' key to see later,
would show me the next month, which was not at all what I wanted.

On the same idea, day view or week view would change my org-agenda-ndays
settings, which I think is not a good idea. Changing user setting is *bad*.
:-)

So I rewrote the things this way:
- Rename org-agenda-span to org-agenda-current-span
 Which has the same meaning has before, except it can be numeric.
- Rename org-agenda-ndays to org-agenda-span
 I think the name is better choosen. You can set it to a symbol instead of
 only a numeric value. That means you can set it to 'month and it will show
 you the number of days of the current month in your agenda. Better than
 30. But you can still set it to 30, or 31, or whatever you want.
- Do not change org-agenda-span. Never.
- Use org-agenda-current-span for navigation.
 That means if you press 'f', it will shows you really the next
 org-agenda-current-span ndays, and not something based on "I think you
 want a weekly view".
doc/org.texi
doc/orgguide.texi
lisp/org-agenda.el
lisp/org-mouse.el