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 6PfWG3iKFWBrHwAA0tVLHw (envelope-from ) for ; Sat, 30 Jan 2021 16:34:00 +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 uF2MF3iKFWBTagAAbx9fmQ (envelope-from ) for ; Sat, 30 Jan 2021 16:34:00 +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 829699402C2 for ; Sat, 30 Jan 2021 16:33:55 +0000 (UTC) Received: from localhost ([::1]:60272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5tC5-0001Y0-QT for larch@yhetil.org; Sat, 30 Jan 2021 11:33:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5tBR-0001Wf-DB for emacs-orgmode@gnu.org; Sat, 30 Jan 2021 11:33:14 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:36507) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5tBM-0007BR-2p for emacs-orgmode@gnu.org; Sat, 30 Jan 2021 11:33:13 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7E1F25C00C5 for ; Sat, 30 Jan 2021 11:33:06 -0500 (EST) Received: from imap34 ([10.202.2.84]) by compute1.internal (MEProxy); Sat, 30 Jan 2021 11:33:06 -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=k++U1pAoNysDJAQwPAMAuyWBoSe70DR 4LIwiosl9dj8=; b=cHc7rkBfLWvjwyig79MqvR9g5L4BimJIMKlJ9IldNBBFiPn 5l5b8+25pROs56ct3/jIZcT84SLmFAEkHOQL5et6shQLdHVQD9Cg1vPFIG39QB74 vBX9CCsrQNHiDa3gnmQfx85IKiccd5AvzfDewgcHleiLEoVMMJUC/06v0RqEH942 4g4Fz0pXW9DIznzEZA+2vHp7wUfOeHb75vOs6N0urOqYtHXJ2/l6/zBQC4wFqQVB 0YE4zc0WbKTgXHwFbq9IzOlfHyUAduqz2Vv84F2mqCblpUoy/fVnNsXhAtkXECyM IW+LZrKlHnF9slHH6rX+JM0CoaDjLyveb71WWsg== 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=k++U1p AoNysDJAQwPAMAuyWBoSe70DR4LIwiosl9dj8=; b=QEwFOG9I4sNHJ2iXm6pceJ K0MoyXOk81cgU7hNLdSdH0jSiLrVDxhDL3aZW3MtFgtuJNOqhWbw+8txH+QLzkg2 M3i5C0jFJI7zL5P6gRDnESvbCoZBP6J671pnER0uyq4/V1NLEtLCMez9yAmHfMdz iuLuaASYTRpJywiJKa6lUfd2pncQnNg02gwiiHoAcZumcWX/0BOg6c/LGzIZsblG z3/vqhkeS8j9d1gcIaZoC9f0qe7MF7Di7CUJqWoybUHvxripRl/r4SUZKeEnIuB8 zykOXiIqyk0LjjB5ui0XzwItQqdRV8Il3zUF+pDAm+9BshZit/2BHENlcsZZawrQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeggdeludcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesthdtre dtreertdenucfhrhhomhepfdevhhhrihhsthhophhhvghrucevrghushgvrhdfuceomhhl qdgvmhgrtghsqdhorhhgmhhouggvsegthhihtgdrtghordhukheqnecuggftrfgrthhtvg hrnhephefgkeevvedvueeuvdfggfehffffkeeuheffgffhleduuddvudeifeekteehhfdu necuffhomhgrihhnpeguihgrrhihrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhlqdgvmhgrtghsqdhorhhgmhhouggvsegthhih tgdrtghordhukh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6036B280066; Sat, 30 Jan 2021 11:33:05 -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: <44e81542-882d-4c36-adcd-69ca90b23f48@www.fastmail.com> In-Reply-To: <87mtwqziuj.fsf@aquinas> References: <79daebf0-5bda-473a-b289-392fd0c8df18@www.fastmail.com> <85e0ac65-f4b6-4212-95bf-2bc24671de06@www.fastmail.com> <87mtwqziuj.fsf@aquinas> Date: Sat, 30 Jan 2021 16:32:42 +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.25; envelope-from=ml-emacs-orgmode@chyc.co.uk; helo=out1-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=cHc7rkBf; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=QEwFOG9I; 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: 829699402C2 X-Spam-Score: -1.44 X-Migadu-Scanner: scn1.migadu.com X-TUID: Gizfe2Z3g8ZT On Sat, 30 Jan 2021, at 12:53, Richard Lawrence wrote: > #+begin_src emacs-lisp > (defun org-update-clocktable-on-date (date) > (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))) > #+end_src This is wonderful Richard, and a great help to me. I had no idea of the org-datree-find-date-create, and the argument to org-clock-report cuts out a lot of my code. > Note that org-datetree-find-date has a slightly annoying interface, in > that you need to provide a list of three integers representing a > calendar date. Yes, that is a little awkward. What I did think of using was substrings to extract the date from the picker interface. #+BEGIN_SRC emacs-lisp (defun org-date-picker-to-list () (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)))) #+END_SRC Does that look sensible? My two next things to tackle are 1. A hook to run the function when I run org-capture. 2. Changing the org-clock-report options in your function above, but not the defaults. For the second point, is there some trick to swap a global variable for the run of a function? The variable in this case would be org-clocktable-defaults. Thank you so much Richard. You've probably saved me days of going through the org-mode documentation and source.