Open
Description
Problem
When an Emacs buffer has been edited but not saved, Emacs generates a lock file in the form of a symlink to a nonexistent file. E.g., when editing SUMMARY.md
:
lrwxrwxrwx 1 david david 35 Oct 22 12:40 .#SUMMARY.md -> david@bibliotecarie.2199:1697969899
mdBook does not like these files:
$ mdbook build
2023-10-22 12:43:28 [INFO] (mdbook::book): Book building has started
2023-10-22 12:43:28 [INFO] (mdbook::book): Running the html backend
2023-10-22 12:43:28 [ERROR] (mdbook::utils): Error: Rendering failed
2023-10-22 12:43:28 [ERROR] (mdbook::utils): Caused By: Failed to read "/home/david/projects/mdbook-project/src/.#SUMMARY.md"
2023-10-22 12:43:28 [ERROR] (mdbook::utils): Caused By: No such file or directory (os error 2)
Steps
- In an mdBook project, open
SUMMARY.md
in Emacs and make a small edit, but do not save. - Run
mdbook build
.
Expected:
- build succeeds, perhaps with a warning
Actual:
- build fails
Possible Solution(s)
- a mechanism to exclude certain file patterns from the build would allow excluding all files of the pattern
.#*.md
- the
build
command (as well aswatch
,serve
, etc.) could (optionally?) ignore broken symlinks
(N.b. I'm new to mdBook; it's possible these mechanisms exist and I'm just not finding them in the docs. In which case, it would be nice to surface them more prominently there.)
Notes
This isn't a showstopper as it's cleared up as soon as the file is saved (or in the event of a crash, as soon as the offending symlink is deleted). Still, it creates a lot of noise, particularly in watch
or serve
mode, and makes it hard to see legitimate warnings/errors.
Version
`mdbook v0.4.35`