From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] org-clock-display is partial (only some entries are counted) Date: Fri, 20 Feb 2015 11:38:44 +0100 Message-ID: <87pp943m17.fsf@nicolasgoaziou.fr> References: <86pp98sxzq.fsf@example.com> <87h9ukutpy.fsf@nicolasgoaziou.fr> <86y4nvqumm.fsf@example.com> <877fvfp8zq.fsf@nicolasgoaziou.fr> <86a90bntnf.fsf@example.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOkxn-0003d9-Ld for emacs-orgmode@gnu.org; Fri, 20 Feb 2015 05:37:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOkxj-0000kc-Jk for emacs-orgmode@gnu.org; Fri, 20 Feb 2015 05:37:39 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:56941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOkxj-0000kV-9i for emacs-orgmode@gnu.org; Fri, 20 Feb 2015 05:37:35 -0500 Received: from mfilter36-d.gandi.net (mfilter36-d.gandi.net [217.70.178.167]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 65BD141C16A for ; Fri, 20 Feb 2015 11:37:34 +0100 (CET) Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter36-d.gandi.net (mfilter36-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id lRo5REWwnFrT for ; Fri, 20 Feb 2015 11:37:32 +0100 (CET) Received: from selenimh (unknown [91.224.148.150]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id AC10A41C0F8 for ; Fri, 20 Feb 2015 11:37:32 +0100 (CET) In-Reply-To: <86a90bntnf.fsf@example.com> (Sebastien Vauban's message of "Wed, 18 Feb 2015 16:09:24 +0100") 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: Org Mode List --=-=-= Content-Type: text/plain Sebastien Vauban writes: > I still consider the default behavior as dangerous -- because the novice > is not aware (except if obvious) that some clock times may be dropped in > the computation, and I find that scary --, but thanks anyway for the > workaround. Would you mind testing the following patch, then? `untilnow' is just a suggestion. Regards, --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-org-clock-Add-untilnow-time-block.patch Content-Transfer-Encoding: quoted-printable >From eec96edbc27a56159642f939a9ccd0e56e348a58 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 20 Feb 2015 11:35:16 +0100 Subject: [PATCH] org-clock: Add `untilnow' time block MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/org-clock.el (org-clock-special-range): Handle `untilnow' range. (org-clock-display-default-range): Add `untilnow' as valid range. * doc/org.texi (The clock table): Document `untilnow' Suggested-by: S=C3=A9bastien Vauban --- doc/org.texi | 1 + lisp/org-clock.el | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index bec46a9..ba553e2 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -6572,6 +6572,7 @@ be selected: thisweek, lastweek, thisweek-@var{N} @r{a relative week} thismonth, lastmonth, thismonth-@var{N} @r{a relative month} thisyear, lastyear, thisyear-@var{N} @r{a relative year} + untilnow @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time = interval.} :tstart @r{A time string specifying when to start considering times.} @r{Relative times like @code{"<-2w>"} can also be used. See} diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 07f02b0..f6cc766 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -440,6 +440,7 @@ This applies when using `org-clock-goto'." (const lastmonth) (const thisyear) (const lastyear) + (const untilnow) (const :tag "Select range interactively" interactive))) =20 (defvar org-clock-in-prepare-hook nil @@ -2087,18 +2088,24 @@ buffer and update it." =20 (defun org-clock-special-range (key &optional time as-strings wstart mstar= t) "Return two times bordering a special time range. -Key is a symbol specifying the range and can be one of `today', `yesterday= ', -`thisweek', `lastweek', `thismonth', `lastmonth', `thisyear', `lastyear'. -By default, a week starts Monday 0:00 and ends Sunday 24:00. -The range is determined relative to TIME, which defaults to current time. -The return value is a cons cell with two internal times like the ones -returned by `current time' or `encode-time'. -If AS-STRINGS is non-nil, the returned times will be formatted strings. -If WSTART is non-nil, use this number to specify the starting day of a -week (monday is 1). -If MSTART is non-nil, use this number to specify the starting day of a -month (1 is the first day of the month). -If you can combine both, the month starting day will have priority." + +KEY is a symbol specifying the range and can be one of `today', +`yesterday', `thisweek', `lastweek', `thismonth', `lastmonth', +`thisyear', `lastyear' or `untilnow'. + +By default, a week starts Monday 0:00 and ends Sunday 24:00. The +range is determined relative to TIME, which defaults to current +time. + +The return value is a cons cell with two internal times like the +ones returned by `current time' or `encode-time'. If AS-STRINGS +is non-nil, the returned times will be formatted strings. + +If WSTART is non-nil, use this number to specify the starting day +of a week (monday is 1). If MSTART is non-nil, use this number +to specify the starting day of a month (1 is the first day of the +month). If you can combine both, the month starting day will +have priority." (if (integerp key) (setq key (intern (number-to-string key)))) (let* ((tm (decode-time (or time (current-time)))) (s 0) (m (nth 1 tm)) (h (nth 2 tm)) @@ -2190,6 +2197,7 @@ If you can combine both, the month starting day will = have priority." month1 (+ 4 (* 3 (- (+ q shift) 1))) h1 0 m1 0)))) ((memq key '(year thisyear)) (setq m 0 h 0 d 1 month 1 y (+ y shift) y1 (1+ y))) + ((eq key 'untilnow) (setq y1 y month1 m d1 d m 0 h 0 d 1 month 1 y 1)) ((eq key 'interactive) nil) (t (user-error "No such time block %s" key))) (setq ts (encode-time s m h d month y) @@ -2205,6 +2213,7 @@ If you can combine both, the month starting day will = have priority." (setq txt (format-time-string "%B %Y" ts))) ((memq key '(year thisyear)) (setq txt (format-time-string "the year %Y" ts))) + ((eq key 'untilnow) (setq txt "now")) ((memq key '(quarter thisq)) (setq txt (concat (org-count-quarter shiftedq) " quarter of " (number-to-string shiftedy))))) --=20 2.3.0 --=-=-=--