From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Agenda: Fortnight time span Date: Fri, 9 Aug 2013 11:43:12 +0200 Message-ID: <232B929F-78C4-4897-B876-DA4C8DA2FF85@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7jEA-0007Hy-9l for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 05:43:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7jE4-0007ZA-Ek for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 05:43:22 -0400 Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:37982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7jE4-0007Yw-5O for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 05:43:16 -0400 Received: by mail-ee0-f44.google.com with SMTP id b47so2033030eek.31 for ; Fri, 09 Aug 2013 02:43:15 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Gauland Cc: emacs-orgmode@gnu.org Hi Michael, I tried to apply this patch and failed - possibly because it is a bit = too old. Could I ask you to make an updated version of the patch for me = to evaluate and resubmit? Thank you - Carsten On 1.5.2013, at 04:54, Michael Gauland wrote: > Agenda: Add fortnight as a time span >=20 > * lisp/org-agenda.el (org-agenda-custom-commands-local-options): Add > fortnight as a choice for org-agenda-span. > (org-agenda-span): Add fortnight as a choice for customising = org-agenda-span. > (): Add 'Fortnight View' to the org-agenda-menu > (org-agenda-list): If number of days is 14, start the agenda on = weekday (as > done for week-long agendas). > (org-agenda-ndays-to-span): Return 14 for 'fortnight'. > (org-agenda-span-to-ndays): Return 'fortnight' for a 14-day span > (org-agenda-later): Go forward 14 days for a fortnight. > (org-agenda-view-mode-dispatch): Add 't' for fortnight view. > (org-agenda-fortnight-view): New function; similar to = org-agenda-week-view. > (org-agenda-change-time-span): Recognise 'fortnight' as a span. > (org-agenda-compute-starting-span): Recognise 'fortnight' as a span. >=20 > I find it convenient to use org-agenda to look two weeks ahead; others = may also. >=20 >=20 > --- > lisp/org-agenda.el | 32 ++++++++++++++++++++++++++------ > 1 files changed, 26 insertions(+), 6 deletions(-) >=20 > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > index fe2c743..1d3b323 100644 > --- a/lisp/org-agenda.el > +++ b/lisp/org-agenda.el > @@ -328,6 +328,7 @@ the daily/weekly agenda, see = `org-agenda-skip-function'.") > (const org-agenda-span) > (choice (const :tag "Day" 'day) > (const :tag "Week" 'week) > + (const :tag "Fortnight" 'fortnight) > (const :tag "Month" 'month) > (const :tag "Year" 'year) > (integer :tag "Custom"))) > @@ -1135,6 +1136,7 @@ Custom commands can set this variable in the = options > section." > :group 'org-agenda-daily/weekly > :type '(choice (const :tag "Day" day) > (const :tag "Week" week) > + (const :tag "Fortnight" fortnight) > (const :tag "Month" month) > (const :tag "Year" year) > (integer :tag "Custom"))) > @@ -2334,7 +2336,11 @@ The following commands are available: > ["Week View" org-agenda-week-view > :active (org-agenda-check-type nil 'agenda) > :style radio :selected (eq org-agenda-current-span 'week) > - :keys "v w (or just w)"] > + :keys "v w"] > + ["Fortnight View" org-agenda-fortnight-view > + :active (org-agenda-check-type nil 'agenda) > + :style radio :selected (eq org-agenda-current-span 'fortnight) > + :keys "v f"] > ["Month View" org-agenda-month-view > :active (org-agenda-check-type nil 'agenda) > :style radio :selected (eq org-agenda-current-span 'month) > @@ -4170,7 +4176,7 @@ items if they have an hour specification like = [h]h:mm." > (sd (or start-day today)) > (ndays (org-agenda-span-to-ndays span sd)) > (org-agenda-start-on-weekday > - (if (eq ndays 7) > + (if (or (eq ndays 7) (eq ndays 14)) > org-agenda-start-on-weekday)) > (thefiles (org-agenda-files nil 'ifmode)) > (files thefiles) > @@ -4339,6 +4345,7 @@ items if they have an hour specification like = [h]h:mm." > (cond ((symbolp n) n) > ((=3D n 1) 'day) > ((=3D n 7) 'week) > + ((=3D n 14) 'fortnight) > (t n))) >=20 > (defun org-agenda-span-to-ndays (span &optional start-day) > @@ -4347,6 +4354,7 @@ START-DAY is an absolute time value." > (cond ((numberp span) span) > ((eq span 'day) 1) > ((eq span 'week) 7) > + ((eq span 'fortnight) 14) > ((eq span 'month) > (let ((date (calendar-gregorian-from-absolute start-day))) > (calendar-last-day-of-month (car date) (caddr date)))) > @@ -7825,6 +7833,8 @@ With prefix ARG, go forward that many times the > current span." > (setq sd (+ arg sd))) > ((eq span 'week) > (setq sd (+ (* 7 arg) sd))) > + ((eq span 'fortnight) > + (setq sd (+ (* 14 arg) sd))) > ((eq span 'month) > (setq greg2 (list (+ (car greg) arg) (nth 1 greg) (nth 2 greg)) > sd (calendar-absolute-from-gregorian greg2)) > @@ -7854,7 +7864,7 @@ 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 =20 > [SPC]reset [q]uit/abort > + (message "View: [d]ay [w]eek for[t]night [m]onth =20= > [y]ear [SPC]reset [q]uit/abort > time[G]rid [[]inactive [f]ollow [l]og [L]og-all = [c]lockcheck > [a]rch-trees [A]rch-files clock[R]eport include[D]iary =20 > [E]ntryText") > (let ((a (read-char-exclusive))) > @@ -7862,6 +7872,7 @@ With prefix ARG, go backward that many times the > current span." > (?\ (call-interactively 'org-agenda-reset-view)) > (?d (call-interactively 'org-agenda-day-view)) > (?w (call-interactively 'org-agenda-week-view)) > + (?t (call-interactively 'org-agenda-fortnight-view)) > (?m (call-interactively 'org-agenda-month-view)) > (?y (call-interactively 'org-agenda-year-view)) > (?l (call-interactively 'org-agenda-log-mode)) > @@ -7900,6 +7911,15 @@ week 12 of year 2007. Years in the range = 1938-2037 > can also be > written as 2-digit years." > (interactive "P") > (org-agenda-change-time-span 'week iso-week)) > +(defun org-agenda-fortnight-view (&optional iso-week) > + "Switch to daily view for agenda. > +With argument ISO-WEEK, switch to the corresponding ISO week. > +If ISO-WEEK has more then 2 digits, only the last two encode the > +week. Any digits before this encode a year. So 200712 means > +week 12 of year 2007. Years in the range 1938-2037 can also be > +written as 2-digit years." > + (interactive "P") > + (org-agenda-change-time-span 'fortnight iso-week)) > (defun org-agenda-month-view (&optional month) > "Switch to monthly view for agenda. > With argument MONTH, switch to that month." > @@ -7921,7 +7941,7 @@ written as 2-digit years." >=20 > (defun org-agenda-change-time-span (span &optional n) > "Change the agenda view to SPAN. > -SPAN may be `day', `week', `month', `year'." > +SPAN may be `day', `week', `fortnight', `month', `year'." > (org-agenda-check-type t 'agenda) > (let* ((args (get-text-property (min (1- (point-max)) (point)) > 'org-last-args)) > (curspan (nth 2 args))) > @@ -7942,7 +7962,7 @@ SPAN may be `day', `week', `month', `year'." >=20 > (defun org-agenda-compute-starting-span (sd span &optional n) > "Compute starting date for agenda. > -SPAN may be `day', `week', `month', `year'. The return value > +SPAN may be `day', `week', `fortnight', `month', `year'. The return = value > is a cons cell with the starting date and the number of days, > so that the date SD will be in that range." > (let* ((greg (calendar-gregorian-from-absolute sd)) > @@ -7955,7 +7975,7 @@ so that the date SD will be in that range." > (setq sd (+ (calendar-absolute-from-gregorian > (list mg 1 yg)) > n -1)))) > - ((eq span 'week) > + ((or (eq span 'week) (eq span 'fortnight)) > (let* ((nt (calendar-day-of-week > (calendar-gregorian-from-absolute sd))) > (d (if org-agenda-start-on-weekday > --=20 > 1.7.9 >=20 >=20 >=20 >=20