From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id aBcOLNtzBWbXWQAA62LTzQ:P1 (envelope-from ) for ; Thu, 28 Mar 2024 14:42:51 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id aBcOLNtzBWbXWQAA62LTzQ (envelope-from ) for ; Thu, 28 Mar 2024 14:42:51 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="fos6t5/m"; 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=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1711633371; 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=a5ZJKDcCI5q6+4Lgoa2Nk2t8HqcIm/nucmsiWgyGGig=; b=khkA5Ptn+xlbk9uLX7Jd8lFxPuKvaXRjgkJIBSIlx2QU673CuU08xD+fjn4n/0WS7AKWLM fKWZOV0baZASXxVhnF8Fw1Odjhydc7I2f832E6t2GIxfllbxS6redGEJKxX6nxEsIjLxzA 2hpYA952FllnTdo+bnQYwlflZ3Kq2qgZnxp00DIvMmkQd5aaM0SYVugXz2N3G4EN8bClcu LSsq4MtEFruNdVUuGDnT084fhQwg47FI5BgKhZDBtMxU47XeY4FGHVY7Z44Ax+jzsbKaUe owpCQfUvNMhkLNPMtEYpknb+OFaUv0SVRbj43anVh8uYo3sMx3yY0cfi/U4BjQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="fos6t5/m"; 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=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711633371; a=rsa-sha256; cv=none; b=rtQ+tmew+AvVq0Hrkl/38H8cvtBV7vxVtKgUWXvckBQ0JmqOLLFT6CfpLXzuDTGTL5XhxZ +F3uur3v26+iB/2n9rNGKQjL8ACx5jWJmYBgTnKqqAKZJkknE5MlXf0pOlAeFMy83+Nwsm VHetjEpus+c1TIk90L7vFba9WJQAJ3O6Ygn966K973p5lO5KSZ7eFPbvbTtsyG08fxrjBB tfztCXao7201X22gnNmtPuQu7d7umhd4NSLqMwqfCxjqgqo01Ww2WyigMYFJ9owJJyYON/ UKpR0c+Fckp4Gzor+DaxZG5WnyCmMbCV15blgIVwz8R/nsDmH7bDg8jzsVLOEQ== 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 663A1226FA for ; Thu, 28 Mar 2024 14:42:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpq1G-0003Iv-RA; Thu, 28 Mar 2024 09:42:14 -0400 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 1roqj5-0006bk-Pi for emacs-orgmode@gnu.org; Mon, 25 Mar 2024 16:15:31 -0400 Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1roqj3-0000UJ-3U for emacs-orgmode@gnu.org; Mon, 25 Mar 2024 16:15:23 -0400 Received: by mail-ua1-x92a.google.com with SMTP id a1e0cc1a2514c-7e043f577c5so2571711241.1 for ; Mon, 25 Mar 2024 13:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711397717; x=1712002517; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=a5ZJKDcCI5q6+4Lgoa2Nk2t8HqcIm/nucmsiWgyGGig=; b=fos6t5/m1YX4GG1zusSsRPJrfjwv1U3JRlH+nnYSgTpWAYX7MeJKasTbrRWbRjtNjD yeP8Iu293HJt1a78zQhcGce4Pmul8cKi//KyhmQ+K03WI0LZDMfm8sh3P3quHOgjLKHX ExbXEv/U5mt+L1lnYQ3Xd89n1q/P2Qyxp8joHgR7YsLoQ8pFlo0xKcFiQ6i3W8GK+3Yl LEA9nmScn32fD7JR4RAGVJiPRwqt6QtXWoT9Bpl4llPg3tppj1e3r6Sm6TTb6cRfg0am RYZ3cUUTSnK2NOVNrV7vjX+3eNH3YHCax9K98c7ZGuIIab1ysGDkiL0L1yD2hYUtHxB1 vPZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711397717; x=1712002517; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=a5ZJKDcCI5q6+4Lgoa2Nk2t8HqcIm/nucmsiWgyGGig=; b=Y3xGth66WO+qDjiBGYBxF7VvUCreQ0Uf3CisMGqTA2DYPtG1rXfaAQYd4XJZfqOJAm TPm4ELns6jedNPTPbL1OmNIAyBEszHUWU/Q5iIC5dlsAmR4WpWJ0vk8cRtoVLHj8iOxc hy+qKuVNh0Fxjhzy4dPC1+IaOokhxCarnT2DJvgVnlyTJFK+tuTU9OXZsRQpycNVrK6l TNsfJr0TzT5SFbwZYqcBWRSFi7j8vJWSilISFUJmoJ8yEkYDM6x1PW0B4sc5xw3EYL+a JwQXtLyjG1HYA+ODIL6TsCXvcrNx49ZbqsDRNXP6FhIRFlcFvC1VgVqwdtHxALw6ejOM WlYg== X-Gm-Message-State: AOJu0YySydVkrduB5bHPGCCOCnflsVsPS04egn0Sh8ClDT3LYlaL7IG0 ZO6vfcmcFQkNWj78pLB7QIwmyRb2SZmno16UcDJrUtSRateKUBns4I6Ni+WEOqVO4pAaOHCwCYy NvB0KX4PwzfREj+eb1WowiKNm3Cr2NPQcLwV0yeYn X-Google-Smtp-Source: AGHT+IE6dhFtk+x5W923vwb6Ud3L4h5YwAXinQ+DNNwV6ekjhPejoaXp9xpfBpZaRui84wxbWYrlXALRuT101DuzB04= X-Received: by 2002:a05:6102:1358:b0:476:6554:95a with SMTP id j24-20020a056102135800b004766554095amr4432939vsl.16.1711397716749; Mon, 25 Mar 2024 13:15:16 -0700 (PDT) MIME-Version: 1.0 From: Akash Pal Date: Tue, 26 Mar 2024 01:45:05 +0530 Message-ID: Subject: [Bug?] Non-existent agenda file %s. To: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000f9f660061481d4a9" Received-SPF: pass client-ip=2607:f8b0:4864:20::92a; envelope-from=akashpaul21@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, HTML_MESSAGE=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-Mailman-Approved-At: Thu, 28 Mar 2024 09:42:10 -0400 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-Queue-Id: 663A1226FA X-Spam-Score: -8.63 X-Migadu-Spam-Score: -8.63 X-Migadu-Scanner: mx10.migadu.com X-TUID: Ce3PTBIR56xL --000000000000f9f660061481d4a9 Content-Type: text/plain; charset="UTF-8" I came across this flow of execution while trying to export a ghost org-file to pdf, meaning that the file is 'created' through #'find-file but not saved. While export the following backtrace is noted: ``` Debugger entered--entering a function: * org-check-agenda-file("/home/akash/Desktop/test.org") org-agenda-prepare-buffers(("/home/akash/Desktop/test.org")) org-map-entries((lambda nil (org-set-tags (delete "attached" (org-get-tags)))) "attached") custom/org-export-remove-attached-tag(latex) org-export-as(latex nil nil nil (:output-file "org-exports/test/test.tex")) org-export-to-file(latex "org-exports/test/test.tex" nil nil nil nil nil org-latex-compile) org-latex-export-to-pdf(nil nil nil nil) org-export-dispatch(nil) funcall-interactively(org-export-dispatch nil) command-execute(org-export-dispatch) ``` I have provisions to call #'org-map-entries before export this triggers #'org-agenda-prepare-buffers which finally calls #'org-check-agenda-files This asks the user what to do with a non existent file Non-existent agenda file %s. [R]emove from list or [A]bort? *Problem* I think this should not be called unless the file is part of 'org-agenda-files I have resorted to advicing the function as follows: ``` ;; Advice-Patch ;; if #'org-map-entries is called then #'org-check-agenda-file is executed through #'org-agenda-prepare-buffers ;; issue: neither functions is relevant to non-agenda files, causes bug asking user for extra input ;; Non-existent agenda file %s. [R]emove from list or [A]bort? ;; see : https://github.com/bzg/org-mode/blob/ec5d76bce1434a54a9a529dbe250b09dc3c132c0/lisp/org.el#L15340 ;; Possible solution: Do not call #'org-agenda-prepare-buffers for non-agenda files => ~exist 'org-agenda-files (defun my-org-agenda-prepare-buffers-advice (orig-func &rest args) "Advice function to modify `org-agenda-prepare-buffers'. It filters the FILES argument to ensure only agenda files are processed." (let ((files (if (listp (car args)) (car args) nil))) (when files (setq files (seq-filter #'(lambda (file) (member file org-agenda-files)) files))) (apply orig-func (list files)))) (advice-add 'org-agenda-prepare-buffers :around #'my-org-agenda-prepare-buffers-advice) ``` I don't know if this is a bug or something peculiar to my use case. Leaving the solution for others to see and possibly advice further. First posted on reddit r/emacs. https://www.reddit.com/r/emacs/comments/1bnhz24/bug_nonexistent_agenda_file_s/ --000000000000f9f660061481d4a9 Content-Type: text/html; charset="UTF-8"

I came across this flow of execution while trying to export a ghost org-file to pdf, meaning that the file is 'created' through #'find-file but not saved. While export the following backtrace is noted:

```
Debugger entered--entering a function: * org-check-agenda-file("/home/akash/Desktop/test.org") org-agenda-prepare-buffers(("/home/akash/Desktop/test.org")) org-map-entries((lambda nil (org-set-tags (delete "attached" (org-get-tags)))) "attached") custom/org-export-remove-attached-tag(latex) org-export-as(latex nil nil nil (:output-file "org-exports/test/test.tex")) org-export-to-file(latex "org-exports/test/test.tex" nil nil nil nil nil org-latex-compile) org-latex-export-to-pdf(nil nil nil nil) org-export-dispatch(nil) funcall-interactively(org-export-dispatch nil) command-execute(org-export-dispatch)

```

I have provisions to call #'org-map-entries before export this triggers #'org-agenda-prepare-buffers which finally calls #'org-check-agenda-files

This asks the user what to do with a non existent file

Non-existent agenda file %s. [R]emove from list or [A]bort?

Problem

I think this should not be called unless the file is part of 'org-agenda-files

I have resorted to advicing the function as follows:

```
;; Advice-Patch ;; if #'org-map-entries is called then #'org-check-agenda-file is executed through #'org-agenda-prepare-buffers ;; issue: neither functions is relevant to non-agenda files, causes bug asking user for extra input ;; Non-existent agenda file %s. [R]emove from list or [A]bort? ;; see : https://github.com/bzg/org-mode/blob/ec5d76bce1434a54a9a529dbe250b09dc3c132c0/lisp/org.el#L15340 ;; Possible solution: Do not call #'org-agenda-prepare-buffers for non-agenda files => ~exist 'org-agenda-files (defun my-org-agenda-prepare-buffers-advice (orig-func &rest args) "Advice function to modify `org-agenda-prepare-buffers'. It filters the FILES argument to ensure only agenda files are processed." (let ((files (if (listp (car args)) (car args) nil))) (when files (setq files (seq-filter #'(lambda (file) (member file org-agenda-files)) files))) (apply orig-func (list files)))) (advice-add 'org-agenda-prepare-buffers :around #'my-org-agenda-prepare-buffers-advice)
```

I don't know if this is a bug or something peculiar to my use case. Leaving the solution for others to see and possibly advice further.

First posted on reddit r/emacs.
https://www.reddit.com/r/emacs/comments/1bnhz24/bug_nonexistent_agenda_file_s/

--000000000000f9f660061481d4a9--