From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id iAEDAFl2qmXm4QAA62LTzQ:P1 (envelope-from ) for ; Fri, 19 Jan 2024 14:17:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id iAEDAFl2qmXm4QAA62LTzQ (envelope-from ) for ; Fri, 19 Jan 2024 14:17:13 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; none 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 E7CCC15B65 for ; Fri, 19 Jan 2024 14:17:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQojS-0001pD-Sz; Fri, 19 Jan 2024 08:16:26 -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 1rQojR-0001o7-01 for emacs-orgmode@gnu.org; Fri, 19 Jan 2024 08:16:25 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQojN-00030R-NO for emacs-orgmode@gnu.org; Fri, 19 Jan 2024 08:16:24 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 08C94240029 for ; Fri, 19 Jan 2024 14:16:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705670179; bh=7CgSnEJEfU5Eflg8O9nxMYgZ9egfsWvsQElWpPUHhno=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=kxJS3+MI8GVczmWAggKGX01HT9mbT10dJfcui3uL0K1zu/kRwc8Hbe4A5gUpQVsa1 v6Zy/xAxajTxbwvbWMAhnN/Hl2uobhzRI1+8mW5yzMlLSmhIiYNAvEaZU02PzogN4u K7DrSYUsqtjXUwCibu8j8xxwY6tDRJ5Ciuq8OFTSY/w66isLhuH84ef58gNkygB6P3 RlP6EYVOPFjduD9rjg2h1mMgQ4J3Z4By2RQvU6lKi6BxD9FX0DJX7jr+eNrmlj7JzZ bipLVUhYjd+GoKXYxl2Gs8WTmd0cembxAiJ4xwqjvVGwwOIXsfNpcCkjY5ct191dVw 1b3rxt27y/tEg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TGg9Y6Zzjz9rxG; Fri, 19 Jan 2024 14:16:17 +0100 (CET) From: Ihor Radchenko To: Joseph Turner Cc: Org Mode Mailing List Subject: Re: [PATCH] Silently remove lockfiles from org-agenda-files In-Reply-To: <87wms5stho.fsf@breatheoutbreathe.in> References: <87wms5stho.fsf@breatheoutbreathe.in> Date: Fri, 19 Jan 2024 13:19:33 +0000 Message-ID: <87y1clo3yy.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.00 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -4.00 X-Migadu-Queue-Id: E7CCC15B65 X-TUID: OIE3YfECqibg Joseph Turner writes: > My Emacs setup broke today due to the presence of a lockfile inside > "~/.local/share/org/todo". I use EXWM, and I show org-agenda on startup: > > (add-hook 'after-init-hook > (lambda () (org-agenda nil "t"))) > (setq initial-buffer-choice (lambda () (get-buffer "*Org Agenda*"))) > > org-agenda-files contained a non-existent file, so org-check-agenda-file > attempted to prompt me. For some reason (maybe EXWM didn't fully load), > Emacs simply hung without prompting, leaving me with a black screen. You may consider reporting the hang to Emacs or EXWM bug tracker. > My configuration contains the equivalent of > > (setopt org-agenda-files > (directory-files-recursively "~/.local/share/org/todo" ".org$")) I'd recommend using a different approach - use org-agenda-file-regexp instead of ".org$"; or use #'file-directory-p as predicate - Org mode then select Org files inside all the listed directories by itself. > The attached patch silently removes lockfiles from org-agenda-files. > - "Make sure FILE exists. If not, ask user what to do." > + "Make sure FILE exists. If not, ask user what to do. > +Automatically exclude lockfiles." > (unless (file-exists-p file) > + (when (string-match-p (rx bos ".#") file) ; Exclude lockfiles > + (org-remove-file file) > + (throw 'nextfile t)) I feel slightly reluctant about this patch: 1. You are only working around the actual problem with agenda file being deleted from disk while Emacs is loading. So, the patch is not solving a real Org mode problem - Org mode prompting about non-existing file is not wrong; your bug has nothing to do with Org mode itself. 2. In theory, there might be users with actual Org files starting from ".#" for whatever reason. The probability is not high, but if users choose to set org-agenda-files directly, file-by-file, that's a choice we should better respect in order to not create a blocker. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at