From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KAloIJLRHmCjbQAA0tVLHw (envelope-from ) for ; Sat, 06 Feb 2021 17:27:46 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id wKEdHJLRHmAJbwAAbx9fmQ (envelope-from ) for ; Sat, 06 Feb 2021 17:27:46 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DFC6B940251 for ; Sat, 6 Feb 2021 17:27:44 +0000 (UTC) Received: from localhost ([::1]:47766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8RN1-0003zY-SB for larch@yhetil.org; Sat, 06 Feb 2021 12:27:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6JIX-0003Ix-FM for emacs-orgmode@gnu.org; Sun, 31 Jan 2021 15:26:17 -0500 Received: from sonic308-5.consmr.mail.bf2.yahoo.com ([74.6.130.44]:35072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l6JIV-0007QB-Cn for emacs-orgmode@gnu.org; Sun, 31 Jan 2021 15:26:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=att.net; s=s1024; t=1612124771; bh=HanCQWP0sRMoDAEXxWCCnLiTcNDIvgMtnSnkhgHd8VQ=; h=Date:From:To:Cc:Subject:Reply-To:References:From:Subject:Reply-To; b=j5e9tNcDbfjXVFMfyZYskvIR8CDImUnhJOZrODriMCvnT1NkqzuUlRQ0iTXl9az+ZZKVIxdVHGd/Nd+1+cY1ghs2iHqlrkVbvDgLIL/d5LNuoi1o+DQixNQO0hsAwfpBR2mQH+YLjZsBtAcV1knz3EFMwoLzk1dBhTCjnfcw9/8= X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1612124771; bh=BrtqH6DsyQcBfH/5IyqCt5STji54vNvj9e4nGE88S9q=; h=Date:From:To:Subject:From:Subject:Reply-To; b=HQA6W/DZAkQNveENcloysSSlEm+sgcVXobnfBNp5eGLBMj2fscicjeluTMEOGMR0mmm2SelIcYnitG07QgJGYUlr3DG5FlNXxq5HSWOAqSWVrX10fs99DMYP5es43U4hz1oes4ga8jPngQzRw8ZUYF5AS9W7R1wodbCUtDE3eRb8Cq4c5ys6mZgISowoDV5DmwjdoTbTRjsYeTxgOGRnVYvAYS9tKGhwMcpozyjTxU3cJT6KtNmuZ+ME3DbGYLLnU5RukNAH0XvorVDIj432YR03oiaLWfRmZN5FY+JXQL34ai7hj00F4g7t8zVAjjt/yV8E69Vj0YTuyeBzFZLYZA== X-YMail-OSG: aOQxYCoVM1mfd89tfRdcRyPKMFtyLx8Q1icmbzYX49YfcdHOvvxCmn1FXIGQm_P NfrrUWrfG3RBAhPA75Zt71thF3KaF0.Vhio21FmmDaCNzjdxAuibbmehO5m7yKVeMN1aElITVmqR F4PKiGw5skopIUJb.Us5_w8otGqduBc2sHgxs3VrL1GanVI2O.TRlgEiv9duPeGuwXrLPX2aMT0n JVY6z10QC2jo9ALmEVTX860QuJjtPnvCKLSzLPLV.57sU_PuwVqKUc9ecbtm9hv5uO9X2mCptTMd ZIGtv77d4Enm81qhecNOj5gi.MISt6XNr1fOHVEFspTDQTXmBzs.CeWC3k1fJNMUXh_fVSGbgzm4 Hp1cWiOnm7SEbw1h6IR0oiMcKHYauJPJ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f76PgAOla7iK5GyH2elQH81rqfanbEV_ tNxPAvs2J49w5MhUvbPCk395hIf6u9TEauwOTcvxE_53Sbi9H0GXxTL18rZt.Uiirvtr._oaAYSx h_RevNp6FK6H_MJtAdZPWPNtm8vOz_8huHG_8w5ZDWrXnHw2e Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.bf2.yahoo.com with HTTP; Sun, 31 Jan 2021 20:26:11 +0000 Received: by smtp422.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 5c02cfccd65e8c131738792e023f63c1; Sun, 31 Jan 2021 20:26:09 +0000 (UTC) Received: from ads by archimedes.mugrats with local (Exim 4.92) (envelope-from ) id 1l6JIX-00071j-4K; Sun, 31 Jan 2021 15:26:17 -0500 Date: Sun, 31 Jan 2021 15:26:17 -0500 From: "Alan D. Salewski" To: emacs-orgmode@gnu.org Subject: [PATCH] org-clock.el: clocktable ':formula %' now includes per-file time pct Message-ID: Mail-Followup-To: emacs-orgmode@gnu.org, "Alan D. Salewski" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline User-Agent: Mutt/2.0.5 (2021-01-21) References: X-Mailer: WebService/1.1.17648 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.8) Received-SPF: none client-ip=74.6.130.44; envelope-from=salewski@att.net; helo=sonic308-5.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 06 Feb 2021 12:26:16 -0500 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "Alan D. Salewski" Cc: "Alan D. Salewski" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=att.net header.s=s1024 header.b=j5e9tNcD; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: DFC6B940251 X-Spam-Score: -1.06 X-Migadu-Scanner: scn1.migadu.com X-TUID: uAAwI1RBwFHR * lisp/org-clock.el (org-clocktable-write-default): When ':formula %' is in-effect, show the per-file time percentage in the '%' column. This change only has an effect when multiple files are contributing to a given clocktable (such as when ':scope agenda' has been specified). The existing behavior is that such tables have an extra 'File' column, and each individual file that contributes has its own summary line with the headline value '*File time*'. Those summary rows also produce a rollup time value for the file in the 'Time' column. Prior to this change, the built-in '%' formula does not produce a calculation for those per-file times in the '%' column (the relevant cells in the '%' column were blank). With this change, the percentage contribution of each individual file time to the total time is shown. The more agenda files you have, the more useful this behavior becomes. TINYCHANGE Signed-off-by: Alan D. Salewski --- lisp/org-clock.el | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index cfd112ec3..8e91609c2 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -2697,7 +2697,18 @@ from the dynamic block definition." (format (concat "| %s %s | %s%s%s" (format org-clock-file-time-cell-format (org-clock--translate "File time" lang)) - " | *%s*|\n") + + ;; The file-time rollup value goes in the first time + ;; column (of which there is always at least one)... + " | *%s*|" + ;; ...and the remaining file time cols (if any) are blank. + (make-string (max 0 (1- time-columns)) ?|) + + ;; Optionally show the percentage contribution of "this" + ;; file time to the total time. + (if (eq formula '%) " %s |" "") + "\n") + (file-name-nondirectory file-name) (if level? "| " "") ;level column, maybe (if timestamp "| " "") ;timestamp column, maybe @@ -2705,7 +2716,12 @@ from the dynamic block definition." (if properties ;properties columns, maybe (make-string (length properties) ?|) "") - (org-duration-from-minutes file-time)))) ;time + (org-duration-from-minutes file-time) ;time + + (cond ((not (eq formula '%)) "") ;time percentage, maybe + ((or (not total-time) (= total-time 0)) "0.0") + (t + (format "%.1f" (* 100 (/ file-time (float total-time))))))))) ;; Get the list of node entries and iterate over it (when (> maxlevel 0) -- a l a n d. s a l e w s k i ads@salewski.email salewski@att.net https://github.com/salewski