From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 2L4UJyfpemfXHgAAe85BDQ:P1 (envelope-from ) for ; Sun, 05 Jan 2025 20:18:47 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 2L4UJyfpemfXHgAAe85BDQ (envelope-from ) for ; Sun, 05 Jan 2025 21:18:47 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=cas.cat header.s=2023 header.b=vJSPgL0K; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=quarantine) header.from=cas.cat ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736108327; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Chzusrd7PbY2P9tf7Qbw3Kss7oVQmtQV37VKq4DrYDg=; b=d3UJ2G8gKBStWAMNoRfc8IXJS7j0B08QnhCD/WZBdvztpfcd3qkY9vZGz0qCA2WUybABk2 Hm98F6OWu/qScp5NGmHf0niEcO+8fzcwotAzrCuqzbAOnIz4TkJxxJaZYlM4+UecEXzUFR fBQvPJhPd+I29MEos1L8Rxbk8JRvx2j5iTfZztFTPPAXqmQwZdBt8OZYvdBHa3HYuw/A+V jlr/6mnSHtbCH/wafQyY2x7f92LIXNYzwfPbtZaJOsPpNApw6jiqERFAB7+bg3gHZtMsU3 YJVH6+kh33m/CJKkgL7o45qXQUs3FdZgoqryVL8HoG6iIBTrTHl5324NJb5sXg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=cas.cat header.s=2023 header.b=vJSPgL0K; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=quarantine) header.from=cas.cat ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736108327; a=rsa-sha256; cv=none; b=CqWxw2liB2mO/FKqtoA+0rYbHpu5iG4v1LVsOttT6wg7nQlerUmZ+4dnc7TO3d5svE8V75 s0kbIe7yNnj3vj9+EO//mtxmjFR6B311hsW42fOQikRfV4STe2nbr8KZXGlhW67GkzCDpz cFMDCjT4VPIe7WZTgb4fECAHP3/a7gCWeNLcuZ6v4OUVlNQhAxFK+zdKpVc429q66wA7ZV gNG5vP6rj+wLuXOZyapRg0B5Oj7eQ1G9DmT/PmVWpjjgDX4uGNLRVNIwcZMSYYGi1owItc RAHj/iyq6DkzqTsmiJBmmyAl6iPQ4G0MMxHMUpSilkSopKpmKmOM0rmHHO6eHw== 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 5C2FD85AD3 for ; Sun, 05 Jan 2025 21:18:47 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUX4Y-0001gC-Th; Sun, 05 Jan 2025 15:18:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUX4P-0001fl-Gb for emacs-orgmode@gnu.org; Sun, 05 Jan 2025 15:17:58 -0500 Received: from cas.cat ([45.150.187.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUX4N-0001I0-Bt for emacs-orgmode@gnu.org; Sun, 05 Jan 2025 15:17:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cas.cat; s=2023; t=1736108268; bh=Id/KlGKjFqmZ10hcaGF+q/I14e6HkD0086yVLrV702Y=; h=Date:To:From:Subject:From; b=vJSPgL0KwL/++mGK7NWBYvJ3bc3zh3xL+UbfVujBk08dblIuwONEz+5pmCt3Zz6OW APNJsJPbDdPvUFdLmrWC4QH6XdaF7Ed2LUssdJfNCsVUTHVwsgZMLPY8ISYakmRJxM OGxKN8+uEzZKz1qBh9l3YiJf8/1bO+/04b9gV3zhmvTOMBWZcfNauYgXHxFQx6gh2j BMtDL9D5aHEW23YoaD0M/CrxYalm4c+AjCuTIzCpquTjcGxT4f/xvRB2J2FFsPbBEb oZp95z9Cnhrvr6SubPonJ0Yk9u3HEqBUmQ9/CMW/aQ4sElk22CInYt3J5CWaQ8sDOk uT92bFAjBE26w== Content-Type: multipart/mixed; boundary="------------wDv4megSCmWBWMicLYiOdMm0" Message-ID: <3f608117-fdcd-454a-9989-1a6be0bb6637@cas.cat> Date: Sun, 5 Jan 2025 21:17:48 +0100 MIME-Version: 1.0 Content-Language: en-US To: emacs-orgmode@gnu.org From: pinmacs Subject: org agenda bulk todo with note Received-SPF: pass client-ip=45.150.187.15; envelope-from=pinmacs@cas.cat; helo=cas.cat 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.39 X-Spam-Score: -5.39 X-Migadu-Queue-Id: 5C2FD85AD3 X-Migadu-Scanner: mx10.migadu.com X-TUID: 7vuXTuxKzlbh This is a multi-part message in MIME format. --------------wDv4megSCmWBWMicLYiOdMm0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Given: 1. A tendency of massively marking all items as schedule [1] 2. Some of that items should be done on daily basis (I generate them with a daily template and the power of org-capture) 3. Life happens and some of them are accumulated, for my last case, that was 29 entries pending to be processed Action: I procedure with a batch action for that 29 entries (imagine here a batch script), and now that it is done, then I need to clear it up from my org-agenda org-agenda-bulk-action  [2] does not serve me because it marks the TODO thing without a note, and it's not possible to add a note with the prefix. Going to offtopic, I also discovered that does not respect the enforce-todo-dependencies [3], ignores if that entries have child todo items. I tried to create a org-agenda-bulk-custom-functions but I failed because I wanted a chosen state and a shared note for all the bulk items and the way that functions work cannot be done. But the bulk items are in a variable (nice), org-agenda-bulk-marked-entries, and you can traverse it with a generic function, so I did it. It took me, unexpectetly, 1h30m to get it working (and I could not find other stuff around), so I am sharing what I have done so other people can benefit, and by the way, I would like to know what do you think of that approach and if you have ideas to improve it. See it attached in file org-agenda-bulk-todo-with-note.el With that script I added a note of resolution of that items saying that it was resolved through my task with CUSTOM_ID/ID X (like when you close multiple issues in a ticketing software) [4] A healthy 2025 for you guys, pinmacs [1] offtopic, but I am sharing it anyway #+begin_src emacs-lisp (defun my/org-heading-insert-scheduled ()   (if (or        (and (string-match-p my/diary-file (buffer-name))             (= (org-current-level) 4))        (and (string-match-p my/board-file (buffer-name))             (= (org-current-level) 4))        (and (string-match-p "projects.org" (buffer-name))             ;; projects are 4-level (tasks start at 6-level, we don't care on its children)             (> (org-current-level) 5))        (and (string-match-p "projects-candidates.org" (buffer-name))             ;; projects are 4-level (tasks start at 3-level, we don't care on its children)             (> (org-current-level) 3))        )       (save-excursion         ;; src https://emacs.stackexchange.com/questions/72147/org-mode-adding-creation-date-property-upon-heading-creation         ;;(org-back-to-heading)         (org-schedule nil (format-time-string "[%Y-%m-%d %a]" nil))))) (add-hook 'org-insert-heading-hook 'my/org-heading-insert-scheduled 'append) #+end_src [2] https://orgmode.org/manual/Agenda-Commands.html [3] (setq org-enforce-todo-dependencies t) https://orgmode.org/manual/TODO-dependencies.html [4] all that state changes are stored, in my case, in (setq org-log-state-notes-into-drawer "TRACE") --------------wDv4megSCmWBWMicLYiOdMm0 Content-Type: text/x-emacs-lisp; charset=UTF-8; name="org-agenda-bulk-todo-with-note.el" Content-Disposition: attachment; filename="org-agenda-bulk-todo-with-note.el" Content-Transfer-Encoding: base64 OzsgdGhpcyBzaG91bGQgYmUgcnVuIHdpdGggTS14Cjs7IGFsbCBzZWxlY3RlZCBidWxrIGVu dHJpZXMgc2hvdWxkIGhhdmUgc2FtZSB0b2RvIGtleXdvcmRzCihkZWZ1biBteS9idWxrLXRv ZG8td2l0aC1ub3RlICgpCiAgIkZvciBlYWNoIG1hcmtlZCBlbnRyeSBpbiB0aGUgT3JnIGFn ZW5kYSwgc2V0IHRoZSBUT0RPIHN0YXRlIHdpdGggYSBzaGFyZWQgbm90ZSwKYW5kIGluc2Vy dCB0aGUgc2FtZSB1c2VyLXByb3ZpZGVkIG5vdGUgZm9yIGFsbCBpdGVtcy4iCiAgKGludGVy YWN0aXZlKQogICh1bmxlc3Mgb3JnLWFnZW5kYS1idWxrLW1hcmtlZC1lbnRyaWVzCiAgICAo dXNlci1lcnJvciAiTm8gZW50cmllcyBhcmUgbWFya2VkIGluIHRoZSBhZ2VuZGEiKS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