emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: :step day doesn't work for agenda clockreport [7.01trans (release_7.01h.214.g7be6.dirty)]
@ 2010-08-27 11:40 Magnus Henoch
  2010-08-27 14:29 ` [Accepted] " Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Henoch @ 2010-08-27 11:40 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     http://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------

I just tried adding :step day to org-agenda-clockreport-parameter-plist,
but then hitting R in the agenda caused a crash, since
org-clocktable-steps expects ts and te to be strings, though in fact
they are Gregorian day numbers.

This patch fixes the problem for me.  It's quite ugly, so I don't expect
it to be committed in its current form :) but I hope it serves as
inspiration for someone to figure out the right way to solve this.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1288 bytes --]

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 4fa0397..18a60c8 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1971,10 +1971,22 @@ the currently selected interval size."
     (when block
       (setq cc (org-clock-special-range block nil t)
 	    ts (car cc) te (nth 1 cc) range-text (nth 2 cc)))
-    (if ts (setq ts (org-float-time
-		     (apply 'encode-time (org-parse-time-string ts)))))
-    (if te (setq te (org-float-time
-		     (apply 'encode-time (org-parse-time-string te)))))
+    (cond
+     ((numberp ts)
+      ;; If ts is a number, it's an absolute day number from org-agenda.
+      (destructuring-bind (month day year) (calendar-gregorian-from-absolute ts)
+	(setq ts (time-to-seconds (encode-time 0 0 0 day month year)))))
+     (ts
+      (setq ts (org-float-time
+		(apply 'encode-time (org-parse-time-string ts))))))
+    (cond
+     ((numberp te)
+      ;; Likewise for te.
+      (destructuring-bind (month day year) (calendar-gregorian-from-absolute te)
+	(setq te (time-to-seconds (encode-time 0 0 0 day month year)))))
+     (te
+      (setq te (org-float-time
+		(apply 'encode-time (org-parse-time-string te))))))
     (setq p1 (plist-put p1 :header ""))
     (setq p1 (plist-put p1 :step nil))
     (setq p1 (plist-put p1 :block nil))

[-- Attachment #3: Type: text/plain, Size: 3565 bytes --]




Emacs  : GNU Emacs 24.0.50.2 (x86_64-apple-darwin10.4.0, NS apple-appkit-1038.32)
 of 2010-08-16 on Magnus-Henochs-MacBook-Pro.local
Package: Org-mode version 7.01trans (release_7.01h.214.g7be6.dirty)

current state:
==============
(setq
 org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
 org-agenda-clockreport-parameter-plist '(:link t :maxlevel 3 :step day)
 org-agenda-files '("~/org/")
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-capture-templates '(("e" "dotemacs" entry
                          (file+headline "~/org/dotemacs.org" "Graduated snippets")
                          "* %^{dotemacs snippet titled}\nAdded on %U.\n#+BEGIN_SRC emacs-lisp\n  %?\n#+END_SRC" :unnarrowed)
                         ("t" "To do" entry (file "~/org/notes.org") "* TODO %?\n%a" :prepend t)
                         ("4" "New activity" entry (file "~/org/notes.org")
                          "* %^{New activity}\n%?\n%a" :prepend t :clock-in t)
                         ("n" "Note" entry (clock) "* Notes %T\n%?"))
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup)
 org-export-latex-format-toc-function 'org-export-latex-format-toc-default
 org-export-preprocess-hook '(org-export-blocks-preprocess)
 org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-toggle-maybe)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-first-hook '(org-beamer-initialize-open-trackers)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
                  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers)
 org-use-speed-commands t
 org-mode-hook '((lambda nil
                  (org-add-hook (quote change-major-mode-hook)
                   (quote org-babel-show-result-all) (quote append) (quote local))
                  )
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-babel-show-result-all append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-refile-targets '((org-agenda-files :maxlevel . 2))
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-export-interblocks '((lob org-babel-exp-lob-one-liners)
                          (src org-babel-exp-inline-src-blocks))
 org-occur-hook '(org-first-headline-recenter)
 org-from-is-user-regexp "\\<Magnus Henoch\\>"
 org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code)
 org-clock-report-include-clocking-task t
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
                               org-beamer-auto-fragile-frames
                               org-beamer-place-default-actions-for-lists)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-export-blocks '((src org-babel-exp-src-blocks nil)
                     (comment org-export-blocks-format-comment t)
                     (ditaa org-export-blocks-format-ditaa nil)
                     (dot org-export-blocks-format-dot nil))
 )

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Accepted] Bug: :step day doesn't work for agenda clockreport [7.01trans (release_7.01h.214.g7be6.dirty)]
  2010-08-27 11:40 Bug: :step day doesn't work for agenda clockreport [7.01trans (release_7.01h.214.g7be6.dirty)] Magnus Henoch
@ 2010-08-27 14:29 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-08-27 14:29 UTC (permalink / raw)
  To: emacs-orgmode

Patch 244 (http://patchwork.newartisans.com/patch/244/) is now "Accepted".

Maintainer comment: Used 'org-float-time' instead of time-to-second and added ChangeLog to commit message.  Otherwise, not ugly at all :-)

This relates to the following submission:

http://mid.gmane.org/%3Cm2wrrcxp00.fsf%40erlang-solutions.com%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [Orgmode] Bug: :step day doesn't work for agenda clockreport
> 	[7.01trans (release_7.01h.214.g7be6.dirty)]
> Date: Fri, 27 Aug 2010 16:40:31 -0000
> From: Magnus Henoch <magnus.henoch@gmail.com>
> X-Patchwork-Id: 244
> Message-Id: <m2wrrcxp00.fsf@erlang-solutions.com>
> To: emacs-orgmode@gnu.org
> 
> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
> 
>      http://orgmode.org/manual/Feedback.html#Feedback
> 
> Your bug report will be posted to the Org-mode mailing list.
> ------------------------------------------------------------------------
> 
> I just tried adding :step day to org-agenda-clockreport-parameter-plist,
> but then hitting R in the agenda caused a crash, since
> org-clocktable-steps expects ts and te to be strings, though in fact
> they are Gregorian day numbers.
> 
> This patch fixes the problem for me.  It's quite ugly, so I don't expect
> it to be committed in its current form :) but I hope it serves as
> inspiration for someone to figure out the right way to solve this.
> Emacs  : GNU Emacs 24.0.50.2 (x86_64-apple-darwin10.4.0, NS apple-appkit-1038.32)
>  of 2010-08-16 on Magnus-Henochs-MacBook-Pro.local
> Package: Org-mode version 7.01trans (release_7.01h.214.g7be6.dirty)
> 
> current state:
> ==============
> (setq
>  org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
>  org-agenda-clockreport-parameter-plist '(:link t :maxlevel 3 :step day)
>  org-agenda-files '("~/org/")
>  org-metaup-hook '(org-babel-load-in-session-maybe)
>  org-capture-templates '(("e" "dotemacs" entry
>                           (file+headline "~/org/dotemacs.org" "Graduated snippets")
>                           "* %^{dotemacs snippet titled}\nAdded on %U.\n#+BEGIN_SRC emacs-lisp\n  %?\n#+END_SRC" :unnarrowed)
>                          ("t" "To do" entry (file "~/org/notes.org") "* TODO %?\n%a" :prepend t)
>                          ("4" "New activity" entry (file "~/org/notes.org")
>                           "* %^{New activity}\n%?\n%a" :prepend t :clock-in t)
>                          ("n" "Note" entry (clock) "* Notes %T\n%?"))
>  org-after-todo-state-change-hook '(org-clock-out-if-current)
>  org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup)
>  org-export-latex-format-toc-function 'org-export-latex-format-toc-default
>  org-export-preprocess-hook '(org-export-blocks-preprocess)
>  org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-toggle-maybe)
>  org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
>  org-confirm-shell-link-function 'yes-or-no-p
>  org-export-first-hook '(org-beamer-initialize-open-trackers)
>  org-agenda-before-write-hook '(org-agenda-add-entry-text)
>  org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
>                   org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
>  org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers)
>  org-use-speed-commands t
>  org-mode-hook '((lambda nil
>                   (org-add-hook (quote change-major-mode-hook)
>                    (quote org-babel-show-result-all) (quote append) (quote local))
>                   )
>                  #[nil "\300\301\302\303\304$\207"
>                    [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
>                  #[nil "\300\301\302\303\304$\207"
>                    [org-add-hook change-major-mode-hook org-babel-show-result-all append local]
>                    5]
>                  org-babel-result-hide-spec org-babel-hide-all-hashes)
>  org-refile-targets '((org-agenda-files :maxlevel . 2))
>  org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
>  org-confirm-elisp-link-function 'yes-or-no-p
>  org-export-interblocks '((lob org-babel-exp-lob-one-liners)
>                           (src org-babel-exp-inline-src-blocks))
>  org-occur-hook '(org-first-headline-recenter)
>  org-from-is-user-regexp "\\<Magnus Henoch\\>"
>  org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code)
>  org-clock-report-include-clocking-task t
>  org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
>                                org-beamer-auto-fragile-frames
>                                org-beamer-place-default-actions-for-lists)
>  org-metadown-hook '(org-babel-pop-to-session-maybe)
>  org-export-blocks '((src org-babel-exp-src-blocks nil)
>                      (comment org-export-blocks-format-comment t)
>                      (ditaa org-export-blocks-format-ditaa nil)
>                      (dot org-export-blocks-format-dot nil))
>  )
> 
> 
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index 4fa0397..18a60c8 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -1971,10 +1971,22 @@ the currently selected interval size."
>      (when block
>        (setq cc (org-clock-special-range block nil t)
>  	    ts (car cc) te (nth 1 cc) range-text (nth 2 cc)))
> -    (if ts (setq ts (org-float-time
> -		     (apply 'encode-time (org-parse-time-string ts)))))
> -    (if te (setq te (org-float-time
> -		     (apply 'encode-time (org-parse-time-string te)))))
> +    (cond
> +     ((numberp ts)
> +      ;; If ts is a number, it's an absolute day number from org-agenda.
> +      (destructuring-bind (month day year) (calendar-gregorian-from-absolute ts)
> +	(setq ts (time-to-seconds (encode-time 0 0 0 day month year)))))
> +     (ts
> +      (setq ts (org-float-time
> +		(apply 'encode-time (org-parse-time-string ts))))))
> +    (cond
> +     ((numberp te)
> +      ;; Likewise for te.
> +      (destructuring-bind (month day year) (calendar-gregorian-from-absolute te)
> +	(setq te (time-to-seconds (encode-time 0 0 0 day month year)))))
> +     (te
> +      (setq te (org-float-time
> +		(apply 'encode-time (org-parse-time-string te))))))
>      (setq p1 (plist-put p1 :header ""))
>      (setq p1 (plist-put p1 :step nil))
>      (setq p1 (plist-put p1 :block nil))
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-27 14:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-27 11:40 Bug: :step day doesn't work for agenda clockreport [7.01trans (release_7.01h.214.g7be6.dirty)] Magnus Henoch
2010-08-27 14:29 ` [Accepted] " Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).