From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer Stengele Subject: Re: 9.0.6 and clock tables Date: Fri, 12 May 2017 16:41:19 +0200 Message-ID: References: <87mvavoyxw.fsf@t3610> <87y3u7sq0k.fsf@t3610> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9Bl7-0007bn-Nt for emacs-orgmode@gnu.org; Fri, 12 May 2017 10:41:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9Bl1-000797-7D for emacs-orgmode@gnu.org; Fri, 12 May 2017 10:41:33 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:63121) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9Bl0-00077y-Rq for emacs-orgmode@gnu.org; Fri, 12 May 2017 10:41:27 -0400 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" To: Roland Everaert , Eric S Fraga , emacs-orgmode Am 08.05.2017 um 12:31 schrieb Roland Everaert: > I just see this. > > Since this morning my clocktable doesn't fill a column related to a > property, any known issue and workaround/fix for this? > > > Regards, > > On Mon, May 8, 2017 at 10:37 AM, Eric S Fraga > wrote: > > On Sunday, 7 May 2017 at 10:16, Nicolas Goaziou wrote: > > Would you happen to have any news on it? > > Had no time but ... > > > BTW, you may need to remove any TBLFM: entry related to % since > this is > > no longer necessary when using :formula %. > > ... removing the existing TBLFM line fixes the problem! Many thanks! > > -- > : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org > release_9.0.6-407-gc28ec3 > > Hi, I have a wrong clock summary in my agenda and also in clock tables since 9.0.6. Also the clock sum format suddenly includes days instead of only hours as before. I have a function overriding the agenda clocktable report - see below. What has changed in terms of clock time sum? It seems this section is no more working as before: (format org-clock-total-time-cell-format (org-minutes-to-clocksum-string (or total-time 0))) org-minutes-to-clocksum-string simply contains "*%s*" Please advise. Thank you. Regards, Rainer (defun rst/org-clocktable-write-default (ipos tables params) "Write out a clock table at position IPOS in the current buffer. TABLES is a list of tables with clocking data as produced by `org-clock-get-table-data'. PARAMS is the parameter property list obtained from the dynamic block definition." ;; This function looks quite complicated, mainly because there are a ;; lot of options which can add or remove columns. I have massively ;; commented this function, the I hope it is understandable. If ;; someone wants to write their own special formatter, this maybe ;; much easier because there can be a fixed format with a ;; well-defined number of columns... (let* ((hlchars '((1 . "*") (2 . "/"))) (lwords (assoc (or (plist-get params :lang) (org-bound-and-true-p org-export-default-language) "en") org-clock-clocktable-language-setup)) (multifile (plist-get params :multifile)) (block (plist-get params :block)) (sort (plist-get params :sort)) (ts (plist-get params :tstart)) (te (plist-get params :tend)) (header (plist-get params :header)) (narrow (plist-get params :narrow)) (ws (or (plist-get params :wstart) 1)) (ms (or (plist-get params :mstart) 1)) (link (plist-get params :link)) (maxlevel (or (plist-get params :maxlevel) 3)) (emph (plist-get params :emphasize)) (level-p (plist-get params :level)) (org-time-clocksum-use-effort-durations (plist-get params :effort-durations)) (timestamp (plist-get params :timestamp)) (properties (plist-get params :properties)) (ntcol (max 1 (or (plist-get params :tcolumns) 100))) (rm-file-column (plist-get params :one-file-with-archives)) (indent (plist-get params :indent)) (case-fold-search t) range-text total-time tbl level hlc formula pcol file-time entries entry headline recalc content narrow-cut-p tcol) ;; Some consistency test for parameters (unless (integerp ntcol) (setq params (plist-put params :tcolumns (setq ntcol 100)))) (when block ;; Get the range text for the header (setq range-text (nth 2 (org-clock-special-range block nil t ws ms)))) ;; Compute the total time (setq total-time (apply '+ (mapcar 'cadr tables))) ;; Now we need to output this tsuff (goto-char ipos) ;; Insert the text *before* the actual table (insert-before-markers (or header ;; Format the standard header (concat "#+CAPTION: " (nth 9 lwords) " [" (substring (format-time-string (cdr org-time-stamp-formats)) 1 -1) "]" (if block (concat ", for " range-text ".") "") "\n"))) ;; Insert the table header line (insert-before-markers "|" ; table line starter ;; (if multifile (concat (nth 1 lwords) "|") "") ; file column, maybe (if level-p (concat (nth 2 lwords) "|") "") ; level column, maybe (if timestamp (concat (nth 3 lwords) "|") "") ; timestamp column, maybe (if properties (concat (mapconcat 'identity properties "|") "|") "") ;properties columns, maybe ;; (concat (nth 4 lwords) "|" (concat (nth 5 lwords) "|\n")) ; headline and time columns ;; Insert the total time in the table (insert-before-markers ;; "|-\n" ; a hline ;; "\n" ; a hline "|" ; table line starter ;; (if multifile (concat "| " (nth 6 lwords) " ") "") ; file column, maybe (if level-p "|" "") ; level column, maybe (if timestamp "|" "") ; timestamp column, maybe (if properties (make-string (length properties) ?|) "") ; properties columns, maybe ;; (concat (format org-clock-total-time-cell-format (nth 7 lwords)) "| ") ; instead of a headline (format org-clock-total-time-cell-format (org-minutes-to-clocksum-string (or total-time 0))) ; the time "|\n") ; close line ;; Now iterate over the tables and insert the data ;; but only if any time has been collected (when (and total-time (> total-time 0)) (while (setq tbl (pop tables)) ;; now tbl is the table resulting from one file. (setq file-time (nth 1 tbl)) (when (or (and file-time (> file-time 0)) (not (plist-get params :fileskip0))) (insert-before-markers "|-\n") ; a hline because a new file starts ;; First the file time, if we have multiple files (when (and nil multifile) ;; Summarize the time collected from this file (insert-before-markers ; (format (concat "| %s %s | %s%s" (format (concat "| %s | %s%s" (format org-clock-file-time-cell-format (nth 8 lwords)) " | *%s*|\n") ; (file-name-nondirectory (car tbl)) (if level-p "| " "") ; level column, maybe (if timestamp "| " "") ; timestamp column, maybe (if properties (make-string (length properties) ?|) "") ;properties columns, maybe (org-minutes-to-clocksum-string (nth 1 tbl))))) ; the time ;; Get the list of node entries and iterate over it (setq entries (nth 2 tbl)) (while (setq entry (pop entries)) (setq level (car entry) headline (nth 1 entry) hlc (if emph (or (cdr (assoc level hlchars)) "") "")) (when narrow-cut-p (if (and (string-match (concat "\\`" org-bracket-link-regexp "\\'") headline) (match-end 3)) (setq headline (format "[[%s][%s]]" (match-string 1 headline) (org-shorten-string (match-string 3 headline) narrow))) (setq headline (org-shorten-string headline narrow)))) (insert-before-markers "|" ; start the table line ;; (if multifile "|" "") ; free space for file name column? (if level-p (format "%d|" (car entry)) "") ; level, maybe (if timestamp (concat (nth 2 entry) "|") "") ; timestamp, maybe (if properties (concat (mapconcat (lambda (p) (or (cdr (assoc p (nth 4 entry))) "")) properties "|") "|") "") ;properties columns, maybe (if indent (org-clocktable-indent-string level) "") ; indentation ;; hlc headline hlc "|" ; headline (make-string (min (1- ntcol) (or (- level 1))) ?|) ; empty fields for higher levels hlc (org-minutes-to-clocksum-string (nth 3 entry)) hlc ; time "|\n" ; close line ))))) ;; When exporting subtrees or regions the region might be ;; activated, so let's disable ̀€delete-active-region' (let ((delete-active-region nil)) (backward-delete-char 1)) ;; Back to beginning, align the table, recalculate if necessary (goto-char ipos) (skip-chars-forward "^|") (org-table-align) (when org-hide-emphasis-markers ;; we need to align a second time (org-table-align)) (when sort (save-excursion (org-table-goto-line 3) (org-table-goto-column (car sort)) (org-table-sort-lines nil (cdr sort)))) (when recalc (if (eq formula '%) (save-excursion (if (and narrow (not narrow-cut-p)) (beginning-of-line 2)) (org-table-goto-column pcol nil 'force) (insert "%"))) (org-table-recalculate 'all)) (when rm-file-column ;; The file column is actually not wanted (forward-char 1) (org-table-delete-column)) total-time))