From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WJooHOtXmmD6KQAAgWs5BA (envelope-from ) for ; Tue, 11 May 2021 12:09:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yNnmF+tXmmCpKQAAB5/wlQ (envelope-from ) for ; Tue, 11 May 2021 10:09:47 +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 C5B0622D94 for ; Tue, 11 May 2021 12:09:46 +0200 (CEST) Received: from localhost ([::1]:38814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgPKj-0002do-V2 for larch@yhetil.org; Tue, 11 May 2021 06:09:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgPIm-00086l-DY for emacs-orgmode@gnu.org; Tue, 11 May 2021 06:07:46 -0400 Received: from out1.migadu.com ([2001:41d0:2:863f::]:61128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgPIf-0007ZD-3f for emacs-orgmode@gnu.org; Tue, 11 May 2021 06:07:43 -0400 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kisaragi-hiu.com; s=key1; t=1620727648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=T4PUyb56d6Yx8mvbdMV4QvsFg4QRP7+/MigbAb/OoYk=; b=pvqorOYKcuZD1SzVRGvVVhixCT6dZn6ny1UhHR+mx5xqL8u5OHb0TOWonocO6Y7z1CnN4r 6Kog0NQOi7Na+PqsNxEUsc2IehFH9LquUu7exQqDCFWmShFUUCYMCC0lhIPrwc56sspyUu /BJac1T/wP8lus2iH5/9K8zBZ6ioZhxrzV9ZVo7RSAvG4zo6YFMHmmHAIvd0MDm7wkCV9V eQVtaTZmsha3FegkmZyc1/Zz+k2mVGIbo7Qa9Qnp4itm94KXNvw2E1UqjBnzzUsTrqQEN6 GEQfh8mPapgwE2jzDK2USa+iWqchg3tuwvZaa+MXmJlXW/IVscOQ4BgqA44fTA== Date: Tue, 11 May 2021 10:07:28 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: mail@kisaragi-hiu.com Message-ID: <670485e3bc62d5fde5f32fd60d2af6f3@kisaragi-hiu.com> Subject: [bug] C-u org-update-statitics-cookies errors out with "Non-existent agenda file" if current file isn't saved To: emacs-orgmode@gnu.org X-Migadu-Auth-User: mail@kisaragi-hiu.com Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=mail@kisaragi-hiu.com; helo=out1.migadu.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, SPF_HELO_NONE=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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620727786; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=T4PUyb56d6Yx8mvbdMV4QvsFg4QRP7+/MigbAb/OoYk=; b=pzlz+w2LwYsbuMc5sfKqfwoifcbXsMdxS1dACsouKJCC2MbOvXS7acMWjvTR5Ffg6f11Y9 axbmFGZvO5Ncdtzg0hvwDd3MmPY+Ka0wTP+cWJN8jvISHfGEoHF3fOsJdrNvVqtHksPipo uNswUAxqxfqtoFu+NM65l2uudHQhnxIT/110AyzoPZ8V6NbUv0mdtPtF+dXOLKygcIFPAU 1ejDCJFs5kAVwRFmjJrGXKiogBxZPjGEveKFdoTue506PAkz8z4Ail0KLnsKVmHOozvYKB 81SSZ4HkaV9yGdUtZVZMTUXVe4KoqVBvv9lDvRuDVCiASOcWz6L7rH2XUAh4tA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620727786; a=rsa-sha256; cv=none; b=pWIwxHjRLp2DeNCEpt7XXOmNxLtjx+gmwvXaJNSFKQxlTuZXrx7+FEGURL3coxK7oPZoNg 3QEsOZn1UcFUlNDaLriwJa73866E7WFE9+EvBXXxgKM7r/hbWX/+780vIyCTx9X1/r5tWY 3CCdRcLNTkgOUPcrGOGU0883p/pV6AxR4D49q0XUce4+8HgCntKlVl9sVlfbhQrWwFGcLa /lp/klCmIiklBDzKJeclFTlS5bJ4+O2OA5bZCxYNEBwo+IYvLO5vWKAFYy+irHBRhxlAbH ubjXHWFeYc5RhtRXwM+AnoUwSSgou9JYmUoQFoFXCwUAsqiEjj6gD23bS0rtPQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kisaragi-hiu.com header.s=key1 header.b=pvqorOYK; 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-Spam-Score: -3.15 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kisaragi-hiu.com header.s=key1 header.b=pvqorOYK; dmarc=pass (policy=reject) header.from=kisaragi-hiu.com; 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: C5B0622D94 X-Spam-Score: -3.15 X-Migadu-Scanner: scn0.migadu.com X-TUID: Z7ikhs6AiuoZ * Reproduction=0A=0A1. emacs -Q=0A2. C-x C-f /tmp/new.org RET=0A3. Type a= nything=0A4. Type C-u C-c # (C-u org-update-statistics-cookies) to try to= update all statistics cookies in the buffer=0A5. Notice the "Non-existen= t agenda file /tmp/new.org." error.=0A=0AThis doesn't happen if the file = already exists.=0A=0AI first saw this reported in this reddit thread: htt= ps://www.reddit.com/r/orgmode/comments/n9g1yf/is_this_a_bug_with_orgupdat= estatisticcookies/ (u/flyin1501 is me)=0A=0A* Expectation=0A=0AAll statis= tics cookies in the buffer are updated no matter if the buffer's associat= ed file is already created or not.=0A=0A* Why this is happening=0A=0A- `o= rg-update-statistics-cookies` (C-c #) uses `org-map-entries` to update al= l cookies.=0A- `org-map-entries` uses `org-agenda-prepare-buffers` to pre= pare the file when SCOPE is nil. Excerpt:=0A=0A (if (not scope)=0A= (progn=0A (org-agenda-prepare-buffers=0A = (and buffer-file-name (list buffer-file-name)))=0A (s= etq res=0A (org-scan-tags=0A func = matcher org--matcher-tags-todo-only start-level)))=0A=0A- This function c= omplains if the file does not exist, causing the error.=0A=0A* Solution (= IMO)=0A=0A`org-map-entries` is quite complex because of its matching and = scoping features; `org-update-statistics-cookies` only updates the curren= t buffer and should use `org-map-region` instead. IMO it should go from= =0A=0A (if all=0A (progn=0A (org-update-checkbox-count= 'all)=0A (org-map-entries 'org-update-parent-todo-statistics))= =0A=0Ato:=0A=0A (if all=0A (progn=0A (org-update-check= box-count 'all)=0A (org-map-region 'org-update-parent-todo-stati= stics (point-min) (point-max)))