From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cNKVHWjVV2FfeQEAgWs5BA (envelope-from ) for ; Sat, 02 Oct 2021 05:43:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id w5dHGWjVV2GvNgAA1q6Kng (envelope-from ) for ; Sat, 02 Oct 2021 03:43:36 +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 C5FC02A002 for ; Sat, 2 Oct 2021 05:43:35 +0200 (CEST) Received: from localhost ([::1]:44752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWVvx-0002yq-S7 for larch@yhetil.org; Fri, 01 Oct 2021 23:43:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWVti-0002yg-MS for emacs-orgmode@gnu.org; Fri, 01 Oct 2021 23:41:15 -0400 Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]:41537) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWVtZ-0000Mp-LJ for emacs-orgmode@gnu.org; Fri, 01 Oct 2021 23:41:14 -0400 Received: by mail-ua1-x92a.google.com with SMTP id b34so8083743uad.8 for ; Fri, 01 Oct 2021 20:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=sWzpSmNJ42AyPNEEU3TT+aVVaxu2ZPSSPcIxZ6cS3b0=; b=Fe7hWWSFaZ5qA98f2P0rbvslFbNErqBlcKXpti//UUYCNURhpO9MaSpaKXbq2Iqr8c s83NlVpdVOtVwSNZY1/yqTRxzAUnyA3njfq0MUxq/LHcJjuW2PMTURPdPVoVqA4q9fZT ilgWw5Z9/yNTptnmCVjdsaF5LKfF+Huwola8T3fapIVfJm2oj1qiOZAUHDak336CuuZA tyky5K9V5DSrM2CppeSgJKaJuywBEtyZq7NqyCx5eJnXXQ702oDNg+QmXKeBL17ZTilw cdbxuJF4k4LNvoAw2oRPifqD/ecUXiLtp8etVBTO1cpuse03rsepjujGIZ+Rqkw3KQTT WFdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=sWzpSmNJ42AyPNEEU3TT+aVVaxu2ZPSSPcIxZ6cS3b0=; b=cRT6htNj/oCI2K2ItotTGa1G8A9HPPRHqBNyegb8R5oKxVZDDyFOtqMhGxxeYYVr29 eEfLdYIelYPuKimxJH2zkouTMmNzp1RJYiZODxKnoRFE7ARGuXBhRdOAqTU2WOjhsEUS 3tHAjQWeVf6IqHO/svxdXbYRsJVJBknuHraXSugY5DKum9cNXRXlkuY2QmG/39Spm2K0 9BEWHeIq/bnvpzblH4BKKd/1Fm9aA+PJo7IlvWqNlnoTIrVBi3cavPWiKQ3iDbJx9WoV U85DEu5H4+zoLm/dwsti/m4H0V1SU1+aKKsfzTEBVLPYqgWkNbuvYMngHkF+ZOdSOXcW ISPA== X-Gm-Message-State: AOAM533dsjrRjm9ooD8a+FKhXHpwSQJZUy73spKCbzCfhSRQ1X6on8xx cEuMDKDozbA/n/TYvAtyBMMvseknEGA3Rw== X-Google-Smtp-Source: ABdhPJwjCmNfpoNrip8fcqo6eid/hmXctbV2VAJgJwndikNusDUSAtW3GAWPsQjnzEgZMs5Ow6DZzQ== X-Received: by 2002:ab0:5b59:: with SMTP id v25mr871455uae.57.1633146063520; Fri, 01 Oct 2021 20:41:03 -0700 (PDT) Received: from r1 ([190.239.232.213]) by smtp.gmail.com with ESMTPSA id h12sm4450742uao.19.2021.10.01.20.41.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 20:41:03 -0700 (PDT) From: Rodrigo Morales To: emacs-orgmode@gnu.org Subject: Bug: org-map-entries calls file-exists-p when SCOPE is nil [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)] Date: Fri, 01 Oct 2021 22:39:17 -0500 Message-ID: <871r54m6xm.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::92a; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-ua1-x92a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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=1633146215; 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=sWzpSmNJ42AyPNEEU3TT+aVVaxu2ZPSSPcIxZ6cS3b0=; b=S53pMADW2e42FQ7zZS9N5apPn+8ShurG3UyqL7YX7LikasjA3xZuhuB49pwN2KTPOehGK3 7uxSihDLtKadXr+qk3MgJP+/NlEOtm4m5+px1T0S/5m/8n4YfE87bka2vG4se574PZLbEU AhFagRyP8oQEFwDw/pLm988qxsFnz5LHGZwDAxGpg7ga4cD94w60PnTmnQoDHMEd80Ig/h CldHBu3dxaddBn9kbC1XwSs1qDweBhEiBol43haKZyKVHlcV3I1NpkmPtE4lt6aItWYDYp taRG5Q9zmIiPMNKHwyEqwSlMzp1US4nu9Q1Ll9Lpr5DE+2kZNoqfEVMz+d4qBw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633146215; a=rsa-sha256; cv=none; b=mG0ovgL/l9RKJcgAJ59ETMEdukyJ7KMWVSsWIgrZH0LG1fmwcVO0gnPfsh46vK4QfxjwCs G6ZZN5yruTrKQJjbRKllHThxIIm8dseKuQr95jCtmXa6uM/GJ3+FV0cEUDnWvzGhD2ZSoh PJX8o/DlwuQIrHfUFkyz+xt7APV5QarbmMLScZ2BYseTA0XBNY9SxpQ/l5MvQslrVJnNC8 +C2w1adVGScJ4eGQxbTyDCUspIaB298KuTsdrWiLRUku+4zoiu0b80gfUPKXDGk91AnQIT uChoKHncw4zqDvSUIMTGFH62wmT7lJsV4lGpNPZjlu0YT0Y4r5U9VHeGc0mSDQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Fe7hWWSF; 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.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Fe7hWWSF; dmarc=pass (policy=none) header.from=gmail.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: C5FC02A002 X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: +g73EiI9UBk2 Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ * Description of the bug When =org-map-entries= is executed in a buffer whose associated file doesn't exist yet and the =SCOPE= argument is =nil=, a prompt for removing the file from agenda files is shown. #+BEGIN_EXAMPLE Non-existent agenda file ~/foo.org. [R]emove from list or [A]bort? #+END_EXAMPLE * Expected results The prompt for deleting the associated file from agenda files is not shown. Why would it be required from users that the associated file exists in disk when they only want to traverse the headlines from the current buffer? * Actual results The prompt for deleting the associated file from agenda files is shown. * Steps to reproduce this bug 1. Open a Org Mode buffer with no file saved in the hard disk. That is, C-x C-f ~/e/unexistent-file.org. Don't save the file. It is important that the associated file doesn't exist in your system. 2. Evaluate the following expression in the previous buffer =(org-map-entries (lambda () t))= At this point, you will get the following prompt in the minibuffer. #+BEGIN_EXAMPLE Non-existent agenda file ~/unexistent-file.org. [R]emove from list or [A]bort? #+END_EXAMPLE * Backtrace The backtrace shown below was obtained by instrumenting the function =org-check-agenda-file= and executing the command shown below in a buffer whose associated file doesn't exist. #+BEGIN_SRC elisp (org-map-entries (lambda () t)) #+END_SRC #+CAPTION: Backtrace #+BEGIN_EXAMPLE org-check-agenda-file("/home/myusername/unexistent-file.org") org-agenda-prepare-buffers(("/home/beep1560/e/5.org")) org-map-entries((closure (t) nil t)) eval((org-map-entries #'(lambda nil t)) t) eval-expression((org-map-entries (lambda nil t)) nil nil 127) funcall-interactively(eval-expression (org-map-entries (lambda nil t)) nil nil 127) call-interactively(eval-expression nil nil) command-execute(eval-expression) #+END_EXAMPLE Just for the record, the implementation of =org-check-agenda-file= is shown below. As we can see below, =file-exists-p= is executed in the file. #+BEGIN_SRC elisp (defun org-check-agenda-file (file) "Make sure FILE exists. If not, ask user what to do." (unless (file-exists-p file) (message "Non-existent agenda file %s. [R]emove from list or [A]bort?" (abbreviate-file-name file)) (let ((r (downcase (read-char-exclusive)))) (cond ((equal r ?r) (org-remove-file file) (throw 'nextfile t)) (t (user-error "Abort")))))) #+END_SRC * Additional information Adam Porter (alphapapa) reported this 2 years ago ([[https://list.orgmode.org/878t73jyow.fsf@alphapapa.net/T/][link]] to the thread), but, this hasn't been fixed as for the latest release (i.e. v9.5) * System information #+BEGIN_SRC elisp (org-version) #+END_SRC #+RESULTS: #+begin_example 9.4.4 #+end_example #+BEGIN_SRC elisp (version) #+END_SRC #+RESULTS: #+begin_example GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-26 #+end_example