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")
call-interactively(save-buffer nil nil)
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
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.