From mboxrd@z Thu Jan 1 00:00:00 1970 From: Noah Slater Subject: Re: Filtering org-clock-display Date: Mon, 26 May 2014 17:35:51 +0200 Message-ID: References: <871twsjnzz.fsf@bzg.ath.cx> <87eh0si1gb.fsf@bzg.ath.cx> <87vbsutone.fsf@bzg.ath.cx> <87oayl3yvo.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf305b13de94dc3004fa4f55dd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WowwS-0004XQ-P4 for emacs-orgmode@gnu.org; Mon, 26 May 2014 11:36:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WowwM-0003bf-Lk for emacs-orgmode@gnu.org; Mon, 26 May 2014 11:36:00 -0400 Received: from mail-yk0-x234.google.com ([2607:f8b0:4002:c07::234]:60247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WowwM-0003bJ-84 for emacs-orgmode@gnu.org; Mon, 26 May 2014 11:35:54 -0400 Received: by mail-yk0-f180.google.com with SMTP id q9so6150019ykb.39 for ; Mon, 26 May 2014 08:35:52 -0700 (PDT) In-Reply-To: <87oayl3yvo.fsf@bzg.ath.cx> 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: Bastien Cc: emacs-orgmode@gnu.org --20cf305b13de94dc3004fa4f55dd Content-Type: text/plain; charset=UTF-8 Aha! Sorry, I hadn't updated my checkout to HEAD. I see that when I run that command now, I get a prompt asking me for "Range" with the following options: lastmonth lastweek lastyear thismonth thisweek thisyear today yesterday And the new doc: With one universal prefix argument, show the total time for today. With two universal prefix arguments, show the total time for a custom range, entered at the prompt. With three universal prefix arguments, show the total time in the echo area. That's pretty cool. Any reason it doesn't use the same syntax as the :tstart param though? This breaks a function I had written (and perhaps other people's functions). To replicate this breakage, I wrote this function: (defun clock-display-test () (interactive) (org-clock-display)) Before this change, that would successfully call org-clock-display. Now it displays this error in *Messages*: clock-display-test: Wrong number of arguments: (lambda (arg) "Show subtree times in the entire buffer. With one universal prefix argument, show the total time for today. With two universal prefix arguments, show the total time for a custom range, entered at the prompt. With three universal prefix arguments, show the total time in the echo area. Use \\[org-clock-remove-overlays] to remove the subtree times." (interactive "P") (org-clock-remove-overlays) (let* ((todayp (equal arg (quote (4)))) (customp (equal arg (quote (16)))) (prop (cond (todayp :org-clock-minutes-today) (customp :org-clock-minutes-custom) (t :org-clock-minutes))) time h m p) (cond (todayp (org-clock-sum-today)) (customp (org-clock-sum-custom)) (t (org-clock-sum))) (if (eq arg (quote (64))) nil (save-excursion (goto-char (point-min)) (while (or (and (equal (setq p (point)) (point-min)) (get-text-property p prop)) (setq p (next-single-property-change (point) prop))) (goto-char p) (if (setq time (get-text-property p prop)) (progn (org-clock-put-overlay time)))) (setq h (/ org-clock-file-total-minutes 60) m (- org-clock-file-total-minutes (* 60 h))) (if org-remove-highlights-with-change (progn (org-add-hook (quote before-change-functions) (quote org-clock-remove-overlays) nil (quote local)))))) (message (concat (format "Total file time%s: " (cond (todayp " for today") (customp " (custom)") (t ""))) (org-minutes-to-clocksum-string org-clock-file-total-minutes) " (%d hours and %d minutes)") h m))), 0 That doesn't look right to me. Should an error be printing out all that stuff like that? How should I change my function to call org-clock-display? Can I pass in the range as an argument somehow? Does it make sense for this function to behave like it used to if you just call it like (org-clock-display) with no other arguments? (i.e. Make this great new functionality backwards compatible, and off-by-default.) On 26 May 2014 07:14, Bastien wrote: > Hi Noah, > > Noah Slater writes: > > > How do I configure the filtering? > > What filtering? > > Please re-read the whole thread (where I mention that we *could* have > an option for the default filtering option). Also put more context in > your questions -- such terse sentences makes me feel like I'm just an > answering machine. > > Thanks, > > -- > Bastien > --20cf305b13de94dc3004fa4f55dd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Aha! Sorry, I hadn't updated my checkout to HEAD.
=
I see that when I run that command now, I get a prompt askin= g me for "Range" with the following options:

lastmonth lastweek lastyear thismonth
thisweek thisyear toda= y yesterday

And the new doc:

<= div>With one universal prefix argument, show the total time for
t= oday. =C2=A0With two universal prefix arguments, show the total time
<= div> for a custom range, entered at the prompt. =C2=A0With three universal
=
prefix arguments, show the total time in the echo area.

That's pretty cool. Any reason it doesn't use the = same syntax as the :tstart param though?

This breaks a function I had written (and perhaps other= people's functions).

To replicate this breaka= ge, I wrote this function:

(defun clock-displ= ay-test ()
=C2=A0 (interactive)
=C2=A0 (org-clock-display))
=

Before this change, that would successfully call org-clock-display. No= w it displays this error in *Messages*:

clock= -display-test: Wrong number of arguments: (lambda (arg) "Show subtree = times in the entire buffer.

With one universal prefix argument, show the total time= for
today. =C2=A0With two universal prefix arguments, show the t= otal time
for a custom range, entered at the prompt. =C2=A0With t= hree universal
prefix arguments, show the total time in the echo area.

=
Use \\[org-clock-remove-overlays] to remove the subtree times.&q= uot; (interactive "P") (org-clock-remove-overlays) (let* ((todayp= (equal arg (quote (4)))) (customp (equal arg (quote (16)))) (prop (cond (t= odayp :org-clock-minutes-today) (customp :org-clock-minutes-custom) (t :org= -clock-minutes))) time h m p) (cond (todayp (org-clock-sum-today)) (customp= (org-clock-sum-custom)) (t (org-clock-sum))) (if (eq arg (quote (64))) nil= (save-excursion (goto-char (point-min)) (while (or (and (equal (setq p (po= int)) (point-min)) (get-text-property p prop)) (setq p (next-single-propert= y-change (point) prop))) (goto-char p) (if (setq time (get-text-property p = prop)) (progn (org-clock-put-overlay time)))) (setq h (/ org-clock-file-tot= al-minutes 60) m (- org-clock-file-total-minutes (* 60 h))) (if org-remove-= highlights-with-change (progn (org-add-hook (quote before-change-functions)= (quote org-clock-remove-overlays) nil (quote local)))))) (message (concat = (format "Total file time%s: " (cond (todayp " for today"= ;) (customp " (custom)") (t ""))) (org-minutes-to-clock= sum-string org-clock-file-total-minutes) " (%d hours and %d minutes)&q= uot;) h m))), 0

That doesn't look right to me. Should an erro= r be printing out all that stuff like that?

How sh= ould I change my function to call org-clock-display? Can I pass in the rang= e as an argument somehow?

Does it make sense for this function to behave like it = used to if you just call it like (org-clock-display) with no other argument= s? (i.e. Make this great new functionality backwards compatible, and off-by= -default.)



On 26 May 2014 07:14, Bastien <bzg@gnu.org> wrote:
Hi Noah,

Noah Slater <nslater@tumbolia.or= g> writes:

> How do I configure the filtering?

What filtering?

Please re-read the whole thread (where I mention that we *could* have
an option for the default filtering option). =C2=A0Also put more context in=
your questions -- such terse sentences makes me feel like I'm just an answering machine.

Thanks,

--
=C2=A0Bastien

--20cf305b13de94dc3004fa4f55dd--