0

I reorganized some of the folders on my computer, in an attempt to get rid of old stuff and organize useful stuff. So with the new directory structure, I am getting all of these auto-save errors.

Error (auto-save): Auto-saving file1.org: Opening output file: File name too long, /home/xxx/.emacs.d/.cache/auto-save/site/#!....file1.org#
Error (auto-save): Auto-saving file2.org: Opening output file: File name too long, /home/xxx/.emacs.d/.cache/auto-save/site/#!....file2.org#
Error (auto-save): Auto-saving file3.org: Opening output file: File name too long, /home/xxx/.emacs.d/.cache/auto-save/site/#!....file3.org#

I am not sure of the cause of the errors. On thing I was thinking is that my hard drive is encrypted and this might interfere with the auto-save operation.

Is there a way to fix this, short of just moving the files to a different directory? Is there a setting I can change to increase the filename length? Has anyone else found a good workaround for this error.

UPDATE:

As per Stephen's suggestion, Spacemacs sets up the auto-save configuration in its own internal files. There is a single reference to auto-save location in the .spacemacs file. The variable dotspacemacs-auto-save-file-location specifies where a file is saved: the cache, in-place, or no auto-saving. Other than that, there did not appear to be any other configurable settings for auto-save.

1

You might want to show us the part of your ~/.emacs which sets up the autosave machinery to use home/xxx/.emacs.d/.cache/auto-save/site/... (or is it a Spacemacs thing?).

But in any case, you should be able to shorten them as follows:

(advice-add 'make-auto-save-file-name :around
            #'my-shorten-auto-save-file-name)
(defun my-shorten-auto-save-file-name (&rest args)
  (let ((buffer-file-name
         (when buffer-file-name (sha1 buffer-file-name))))
    (apply args)))
  • Oh thanks so much for this. All the Emacs error messages just kept capturing the focus from whatever application I was working on :). Good point about the emacs config--this is a Spacemacs thing. Looks like there is only a reference to this in one of the Spacemacs setting variables dotspacemacs-auto-save-file-location. But the only choices are to either save the file in the cache, in-place, or not to auto-save. I can mention this in an edit to the question. – krishnab Mar 13 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.