Joseph Turner <jos...@breatheoutbreathe.in> 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 <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>