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 MKS/DGcmF2DVOAAA0tVLHw (envelope-from ) for ; Sun, 31 Jan 2021 21:51:35 +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 oHllCGcmF2BePAAAbx9fmQ (envelope-from ) for ; Sun, 31 Jan 2021 21:51:35 +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 DEEC49403C9 for ; Sun, 31 Jan 2021 21:51:29 +0000 (UTC) Received: from localhost ([::1]:48068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6Kcy-0003na-Gj for larch@yhetil.org; Sun, 31 Jan 2021 16:51:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6KcH-0003nT-E2 for emacs-orgmode@gnu.org; Sun, 31 Jan 2021 16:50:45 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:41263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6KcF-0003lB-4s for emacs-orgmode@gnu.org; Sun, 31 Jan 2021 16:50:45 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id E7E807C8; Sun, 31 Jan 2021 16:50:39 -0500 (EST) Received: from imap5 ([10.202.2.55]) by compute4.internal (MEProxy); Sun, 31 Jan 2021 16:50:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h= mime-version:message-id:date:from:to:cc:subject:content-type; s= fm2; bh=HanCQWP0sRMoDAEXxWCCnLiTcNDIvgMtnSnkhgHd8VQ=; b=tSGO88pZ LkLlQsxf2Fpiq3k8oP9u6w1+mB4MI7vcKE3kKVyUQhcYoUOoPCsfSFeMq4HxcHuU jqS0Y3sBKLXE95cVT4ydIqNPXblZnEsKYvWIo6zSHh6t0YzZsHVoAdUQ524+Qrsx Jjb8BUPq3zeDxfL/rAh0xHeZBN571wPoUyRWKmEquEAB98ZVpwO75vVHxE4otrss 2HxDwEj02affqUt02k2wvJYXVd5+1pXI5nZh/VoXVBUq5ci/MO8OnZxGUnUirR3W WKswFFpUUZy7+zWxRjzEZwP6MZYKWWgoGN+/x0Cg0ykwgcAlfrm8w0NS1ijC9daJ jxTqnHE81uYB/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=HanCQWP0sRMoDAEXxWCCnLiTcNDIv gMtnSnkhgHd8VQ=; b=h/sf6rjdgXKHER5W8P2PEsIY+CMnBxSl/D0FOKLS46Yo/ 5t/n5DJg8plWG1Zi5oJIIUlyoXp38YwJCf7sPNmCN+mmioaENHWDchqhjfkjOYB8 /Onh+tlce1ncwa+LpKqKQqd7vc4z22D/U7HZH+P8aqUSSTyjNiNE0xJ7k91Hiz8v ECOkZOCpbBgvudvpuhdLE5GKYMp/Z2XhTH843GP60zGlbsU5jlBQVZMd2sav35eQ QzMfnwus400jBcEGRzzt9+5ebNKfmmZBqvo82G7p1bB/rFs8XFOKCfCrRcx8l2Bg TGBjRlth3v74vngeznfLfAcafon/8nwo1fz6E490w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeigdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtsehttdertd erreejnecuhfhrohhmpedftehlrghnucffrdcuufgrlhgvfihskhhifdcuoegrughssehs rghlvgifshhkihdrvghmrghilheqnecuggftrfgrthhtvghrnheptedujeettdeigfetie dtkeettedvjeffkeehkeejgfeggeegfeffgeefkedtjefhnecuffhomhgrihhnpehgihht hhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrughssehsrghlvgifshhkihdrvghmrghilh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2A941A0060; Sun, 31 Jan 2021 16:50:39 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-84-gfc141fe8b8-fm-20210125.001-gfc141fe8 Mime-Version: 1.0 Message-Id: <87568139-5afb-480c-948c-4a65b5c8c0bb@www.fastmail.com> Date: Sun, 31 Jan 2021 16:49:35 -0500 From: "Alan D. Salewski" To: emacs-orgmode@gnu.org Subject: =?UTF-8?Q?[PATCH]_org-clock.el:_clocktable_':formula_%'_now_includes_per?= =?UTF-8?Q?-file_time_pct?= Content-Type: text/plain Received-SPF: none client-ip=64.147.123.19; envelope-from=ads@salewski.email; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , 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: -0.35 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=fm2 header.b=tSGO88pZ; dkim=pass header.d=messagingengine.com header.s=fm1 header.b="h/sf6rjd"; 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: DEEC49403C9 X-Spam-Score: -0.35 X-Migadu-Scanner: scn1.migadu.com X-TUID: wDWNMA35v1Z4 * 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