Hugo server watch should ignore Emacs lock files

When I start to edit a post file in Emacs, the editor creates a lock file that is a symbolic link starting with “.#” followed by the file name, and pointing at a nonexistent filename containing information about who has the lock.

The creation of this file causes “hugo server watch” to rebuild the site, in turn causing the browser to reload the page with a flash. The server also outputs an error message like:

ERROR: 2015/06/03 Cannot read symbolic link 'XXX/.#YYY.md', error was: lstat XXX/ZZZ: no such file or directory

I would like to be able to tell hugo some filename patterns it should completely ignore, at least for triggering a rebuild of the site. This would be good for all editors that might generate lock files, auto-save files, and backup files.

Yea, we have a hardcoded ignore list … but it should be configurable (a regexp). Could you create a GitHub issue?

Thanks. Done: https://github.com/spf13/hugo/issues/1189

1 Like

I can’t seem to get this working.

I’m using {Less} to pre-process the CSS file in my site’s theme. So I’ve got:

/themes/mythemename/static/css/mysitename.less

which compiles to:

/themes/mythemename/static/css/mysitename.css

I’ve added:

IgnoreFiles = [ "\\.less$"]

to my /config.toml, but the .less file is still being copied alongside the .css one to /static/css/ when Hugo regenerates the site.