From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: [Accepted] Bug: :step day doesn't work for agenda clockreport [7.01trans (release_7.01h.214.g7be6.dirty)] Date: Fri, 27 Aug 2010 16:29:32 +0200 (CEST) Message-ID: <20100827142932.8FA546D420E@u016822.science.uva.nl> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=40329 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oozw2-0005Tq-RV for emacs-orgmode@gnu.org; Fri, 27 Aug 2010 10:29:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oozw1-0007Ek-BC for emacs-orgmode@gnu.org; Fri, 27 Aug 2010 10:29:38 -0400 Received: from u016822.science.uva.nl ([146.50.39.34]:52358) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oozw0-0007E4-U5 for emacs-orgmode@gnu.org; Fri, 27 Aug 2010 10:29:37 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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 > X-Patchwork-Id: 244 > Message-Id: > 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 "\\" > 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)) >