Browse Source

Add command to reset agenda time span

* org-agenda.el (org-agenda-reset-view): New function.
(org-agenda-view-mode-dispatch): Bind space to org-agenda-reset-view.

Signed-off-by: Julien Danjou <julien@danjou.info>

* doc/org.texi (Agenda commands): Document `v SPC'.

* doc/orgcard.tex: Document v SPC
Julien Danjou 14 years ago
parent
commit
dc55710b60
3 changed files with 20 additions and 12 deletions
  1. 13 10
      doc/org.texi
  2. 1 1
      doc/orgcard.tex
  3. 6 1
      lisp/org-agenda.el

+ 13 - 10
doc/org.texi

@@ -7643,16 +7643,19 @@ Delete other windows.
 @xorgcmdkskc{v w,w,org-aganda-day-view}
 @xorgcmd{v m,org-agenda-month-view}
 @xorgcmd{v y,org-agenda-month-year}
-Switch to day/week/month/year view.  When switching to day or week view,
-this setting becomes the default for subsequent agenda commands.  Since
-month and year views are slow to create, they do not become the default.
-A numeric prefix argument may be used to jump directly to a specific day
-of the year, ISO week, month, or year, respectively.  For example,
-@kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9.  When
-setting day, week, or month view, a year may be encoded in the prefix
-argument as well.  For example, @kbd{200712 w} will jump to week 12 in
-2007.  If such a year specification has only one or two digits, it will
-be mapped to the interval 1938-2037.
+@xorgcmd{v SPC,org-agenda-reset-view}
+@vindex org-agenda-span
+Switch to day/week/month/year view.  When switching to day or week view, this
+setting becomes the default for subsequent agenda refreshes.  Since month and
+year views are slow to create, they do not become the default.  A numeric
+prefix argument may be used to jump directly to a specific day of the year,
+ISO week, month, or year, respectively.  For example, @kbd{32 d} jumps to
+February 1st, @kbd{9 w} to ISO week number 9.  When setting day, week, or
+month view, a year may be encoded in the prefix argument as well.  For
+example, @kbd{200712 w} will jump to week 12 in 2007.  If such a year
+specification has only one or two digits, it will be mapped to the interval
+1938-2037. @kbd{v @key{SPC}} will reset to what is set in
+@code{org-agenda-span}.
 @c
 @orgcmd{f,org-agenda-later}
 Go forward in time to display the following @code{org-agenda-current-span} days.

+ 1 - 1
doc/orgcard.tex

@@ -586,7 +586,7 @@ after  ``{\tt :}'', and dictionary words elsewhere.
 
 \key{delete other windows}{o}
 \key{view mode dispatcher}{v}
-\key{switch to day/week/month/year view}{d w vm vy}
+\key{switch to day/week/month/year/def view}{d w vm vy vSP}
 \key{toggle diary entries / time grid / habits}{D / G / K}
 \key{toggle entry text / clock report}{E / R}
 \key{toggle display of logbook entries}{l / v l/L}

+ 6 - 1
lisp/org-agenda.el

@@ -6154,11 +6154,12 @@ With prefix ARG, go backward that many times the current span."
 (defun org-agenda-view-mode-dispatch ()
   "Call one of the view mode commands."
   (interactive)
-  (message "View: [d]ay [w]eek [m]onth [y]ear                         [q]uit/abort
+  (message "View: [d]ay [w]eek [m]onth [y]ear [SPC]reset                [q]uit/abort
       time[G]rid     [[]inactive [f]ollow [l]og [L]og-all   [E]ntryText
       [a]rch-trees   [A]rch-files    clock[R]eport   include[D]iary")
   (let ((a (read-char-exclusive)))
     (case a
+      (?\  (call-interactively 'org-agenda-reset-view))
       (?d (call-interactively 'org-agenda-day-view))
       (?w (call-interactively 'org-agenda-week-view))
       (?m (call-interactively 'org-agenda-month-view))
@@ -6180,6 +6181,10 @@ With prefix ARG, go backward that many times the current span."
       (?q (message "Abort"))
       (otherwise (error "Invalid key" )))))
 
+(defun org-agenda-reset-view ()
+  "Switch to default view for agenda."
+  (interactive)
+  (org-agenda-change-time-span (or org-agenda-ndays org-agenda-span)))
 (defun org-agenda-day-view (&optional day-of-year)
   "Switch to daily view for agenda.
 With argument DAY-OF-YEAR, switch to that day of the year."