2

I'm experiencing a weird problem with Emacs on Windows where sometimes, after a while, the current buffer I'm in throws an error when attempting to save the file. I can't seem to reliably reproduce the issue (since when I first open the file, it saves fine and even for a few times after that), but after working on it for a while, suddenly I'll get an error when attempting to save the file. The only resolution is to restart Emacs; simply killing and re-opening the buffer has no effect. Turning on toggle-debug-on-error gives me the following:

Debugger entered--Lisp error: (file-error "Opening output file" "invalid argument" "c:/Users/sonictk/Git/experiments/opengl_test/main.cpp") write-region(nil nil "c:/Users/sonictk/Git/experiments/opengl_test/main.cpp" nil t "~/Git/experiments/opengl_test/main.cpp") basic-save-buffer-2() basic-save-buffer-1() basic-save-buffer() save-buffer(1) call-interactively(save-buffer nil nil) command-execute(save-buffer)

I'm not sure how to go about debugging this further since these seem to be built-in functions; could anyone provide any advice on how best I should proceed?

I tried turning on debug-on-entry for write-region for a file that doesn't seem to have the issue compared with a file that does, and I couldn't see any difference passed to the function calls

``` This works:

write-region(nil nil "c:/Users/sonictk/Git/experiments/opengl_test/shaders/vert.glsl" nil t "~/Git/experiments/opengl_test/shaders/vert.glsl")

Somehow, this doesn't, after a while:

  • write-region(nil nil "c:/Users/sonictk/Git/experiments/opengl_test/main.cpp" nil t "~/Git/experiments/opengl_test/main.cpp") ```

I can't understand it; what could be the issue?

UPDATE: As usual, I find the answer only after giving up after a few hours and posting on the interwebs; turns out irony-mode was keeping an open file handle to the file in question for some reason which prevented anything (not just Emacs) from overwriting the file. Now I just have to figure out why irony is behaving the way it is only with this file in particular.

  • Are you using the latest stable release of Emacs for Windows; i.e. 25.3? – lawlist Jan 2 '18 at 0:05
  • @lawlist I'm currently on GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570. I'm a little skeptical that it's the Emacs version specifically, since this seems to happen only with this file for some reason that I haven't quite managed to figure out yet. I could try upgrading, but I'd prefer for that to be a last resort. – sonictk Jan 2 '18 at 0:13
  • I had the same problem using C-x C-w with the same name worked for me. I've also had this issue when I've had opened Notepad++ but not the file I was saving in Emacs and closing Notepad++ solved the issue. – jcubic Sep 11 '18 at 13:47

Your Answer

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

Browse other questions tagged or ask your own question.