From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2HOQCuvgFWAnWAAA0tVLHw (envelope-from ) for ; Sat, 30 Jan 2021 22:42:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id UNpqBuvgFWBwSwAA1q6Kng (envelope-from ) for ; Sat, 30 Jan 2021 22:42:51 +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 84999940366 for ; Sat, 30 Jan 2021 22:42:48 +0000 (UTC) Received: from localhost ([::1]:43714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5yx5-00025C-Gn for larch@yhetil.org; Sat, 30 Jan 2021 17:42:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5yvJ-000253-IP for emacs-orgmode@gnu.org; Sat, 30 Jan 2021 17:40:58 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:52129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5yv8-0003bP-8G for emacs-orgmode@gnu.org; Sat, 30 Jan 2021 17:40:48 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6D1195C010D for ; Sat, 30 Jan 2021 17:40:44 -0500 (EST) Received: from imap34 ([10.202.2.84]) by compute1.internal (MEProxy); Sat, 30 Jan 2021 17:40:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm2; bh=YoqQxMQsWwZhc0/faDKKPy6bz5DcS8N OQrJ31mF/xs4=; b=QFex1JSPdDRctqp7AmhvA72mYtNq8rrdPTxtfPk+TKew5RG kJxkMsnwnPlD6HVZQRxjTiHWFXylAqiIvCMmwpaWiXsToy4yCl/Iw3hZToJhYCfr WDCBoQ9PKf3HwmGu5ldSdtrpRpXaV/flSDWvOp2Fn1Wa1wX3yJtAn1IolvNlDE0D s649n8ysbelBGgFr3DgvyY/+KsBWs4I9OqxtNsdyDgzStNUGwjM+oyX8q+bHa+bz aJv/N2xB5vptl2mHaVx0aB7sNVXtlryT1BOdgUGVU6qL7fDn9egd59FHLh64NC6V 3nYHMfPAwwsrUXSJ9mOLJyoSYcYjaMlLt/8EUHg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=YoqQxM QsWwZhc0/faDKKPy6bz5DcS8NOQrJ31mF/xs4=; b=q9MywOf4eFd8ZpJgBrJ9/r INB91ihZtfNgPQ6oIX29P+c24zLqcrXEJIA+tZiHSlHWUlRdpAOdfo6UqxCpIWSj H5jDd6plWLtiGsl4XB1ebVV3hoHFKZ08aOrK1NcLxEzM/NqNItmPbYKwLHqaEz2L K0ERJVpni0UPOsKAGTdhEbli+8Yxo0Xc5XNgIfMp1aM+hmjTj2Q1SaoC6MYDkPyj lRzw6dxWO3C6YuFrk1FgvOTRhWENtw5YEfUhJn1WBckee1aGuRGosSaorF+Ipmcb 8OpXPgIGiUeeMG5lERB8DPHUG0++SmNXP3azhIzf5Tg6jFpFtG0ArqAvLM3Bm9Ig == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeggdduieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsehttd ertderredtnecuhfhrohhmpedfvehhrhhishhtohhphhgvrhcuvegruhhsvghrfdcuoehm lhdqvghmrggtshdqohhrghhmohguvgestghhhigtrdgtohdruhhkqeenucggtffrrghtth gvrhhnpeekleehtedtfeelfedtieeuueffvdeukeffueelkedthffhhfeggffhieejkeeh gfenucffohhmrghinhepughirghrhidrohhrghdpohhrghhmohguvgdrohhrghenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmlhdqvghmrggt shdqohhrghhmohguvgestghhhigtrdgtohdruhhk X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 30177280066; Sat, 30 Jan 2021 17:40:43 -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: <1a9a61b4-a5f9-471b-80e5-1c52902b392d@www.fastmail.com> In-Reply-To: <87im7ez6zz.fsf@aquinas> References: <79daebf0-5bda-473a-b289-392fd0c8df18@www.fastmail.com> <85e0ac65-f4b6-4212-95bf-2bc24671de06@www.fastmail.com> <87mtwqziuj.fsf@aquinas> <44e81542-882d-4c36-adcd-69ca90b23f48@www.fastmail.com> <87im7ez6zz.fsf@aquinas> Date: Sat, 30 Jan 2021 22:40:22 +0000 From: "Christopher Causer" To: orgmode Subject: Re: clock-table and hooking that into org-capture file+olp+datetree Content-Type: text/plain Received-SPF: pass client-ip=66.111.4.27; envelope-from=ml-emacs-orgmode@chyc.co.uk; helo=out3-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.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.44 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=fm2 header.b=QFex1JSP; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=q9MywOf4; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=chyc.co.uk (policy=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: 84999940366 X-Spam-Score: -1.44 X-Migadu-Scanner: scn1.migadu.com X-TUID: zTNa6ETk1NT9 Thanks again Richard. I now have a working solution which I share below, warts and all. One snag I hit that I feel I should mention is what I believe to be a mistake in the documentation[1]. I was scratching my head as why org-clocktable-defaults wasn't working, but it was only when I brought up the inline documentation that I see that this probably is some vestigial variableand it has since moved to org-clock-clocktable-default-properties. Is mentioning this here on the list enough or should I report it somewhere else? Christopher #+BEGIN_SRC emacs-lisp (defun org-date-to-list () "Run `org-read-date' and return it in the form '(mm dd YYYY). This form is more useful for functions that require it in this format, such as `org-datetree-find-date-create'." (let* ((date-string (org-read-date)) (year (substring date-string 0 4)) (month (substring date-string 5 7)) (day (substring date-string 8 10))) (mapcar 'string-to-number (list month day year)))) (defun org-update-clocktable-on-date (date) (let* ((year (number-to-string (nth 2 date))) (month (number-to-string (nth 0 date))) (day (number-to-string (nth 1 date))) (org-clock-clocktable-default-properties (list :scope 'agenda :maxlevel 6 :block (concat year "-" month "-" day)))) (save-excursion ;; open the file containing the datetree: (find-file (concat org-directory "/diary.org")) ;; jump to the subtree for the given date: ;; note: date must look like (m d y) where all three values are integers (org-datetree-find-date-create date) ;; narrow to the subtree for this date, so we don't update ;; any other clocktables (org-narrow-to-subtree) ;; update the clock report, or create it if it doesn't exist ;; note: we pass a prefix argument to tell org-clock-report to ;; update the first clocktable it finds in the (narrowed) buffer (org-clock-report t) ;; widen to the whole buffer again (widen)))) ;; Usage ; (org-update-clocktable-on-date (org-date-to-list)) #+END_SRC [1] Variable org-clocktable-defaults is mentioned here https://orgmode.org/manual/The-clock-table.html