简体   繁体   中英

file watch, no such file or directory for emacs autosave file

gulp watches files for livereload,

gulp.watch([
    '/templates/**/*.hbs'
], ['build-dev-templates']);

but when i edit on emacs, it creates autosave files like .#index.hbs and Gaze gives this error:

Error: ENOENT, no such file or directory 'app/client/templates/.#index.hbs'

How do i get rid of this?

One option would be to move your backup files elsewhere. I use this snippet from What the .emacs.d!? to put all backup files into ~/.emacs.d/backups :

(setq backup-directory-alist
      `(("." . ,(expand-file-name
                 (concat user-emacs-directory "backups")))))

You should be able to use a similar technique for moving auto-save files . Something like this should work:

(setq auto-save-file-name-transforms
          `((".*" ,(expand-file-name
                    (concat user-emacs-directory "auto-save")) t)))

You can also try to exclude the backup files of your watcher with this pattern :

gulp.watch([
  '/templates/**/*.hbs',
  '!/templates/**/.#*'
], ['build-dev-templates']);

For me, the only thing that worked was to disable the .# file creation with

(setq create-lockfiles nil)

This functionality has been added in Emacs 24.3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM