How to ignore emacs temp files in Jekyll?

Viewed 96

I have Jekyll blog and when I run jekyll serve, and I'm editing the post in GNU Emacs I got this output:

  Regenerating: 2 file(s) changed at 2020-02-28 09:05:34
                _posts/2018-10-20-pytania-rekrutacyjne-css.markdown
                _posts/.#2018-10-20-pytania-rekrutacyjne-css.markdown
                ...done in 13.517243884 seconds.

is it possible to ignore files that starts with .#. I assume it would be twice as fast to generate the html page.

I've tried this:

exclude:
    -
        README.md
    -
        .\#*
    -
        _posts/.\#*

but this don't work, it regenerate when I save _config.yml (as .#_config.yml) the same as with posts.

I would like to ignore every Emacs file in my Jekyll project.

2 Answers

Files with a .# prefix are lockfiles. They prevent separate Emacs instances from editing the same file at the same time. See https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html. Personally, I set (setq create-lockfiles nil) because I rarely run more than one Emacs, and I have (global-auto-revert-mode 1). auto-revert-mode will watch for a file to be changed and automatically reload it (or tell you it has changed if there are unsaved changes).

Also take a look at https://github.com/emacscollective/no-littering to move autosave and backup files to a common place instead of next to whatever file you're editing.

Probably only the message is confusing. It says 2 files changed, which is correct. It does not say 2 files regenerated. My config does not even exclude .#-files. I get the same message, but no .#-file is generated. Check the _site folder. And check the time to regenerate the output file

touch _posts/2018-10-20-pytania-rekrutacyjne-css.markdown # still around 14 sec?
touch _posts/.#2018-10-20-pytania-rekrutacyjne-css.markdown # should be close to zero?

Related