0

I'm using emacs:

GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

And I seem to be seeing a particularly strange problem: emacs, in haskell-mode keeps writing to the file repeatedly after each keystroke (also at times after a few keystrokes). I've read online that some of the common tips to debug issues like these, and to identify the culprit mode, one must selectively disable modes one by one and see which one is causing this.

However, I was wondering if there was a better and less ad-hoc way for going about this: setting breakpoints.

I've tried to set debug points on save-buffer, write-file, and save-some-buffers, but this file-write operation doesn't seem to hit those breakpoints.

Are there more functions in elisp that deal with writing to files? If so, which ones? And is my technique in trying to identify the culprit sound? Or is setting breakpoints not the ideal way of going about this?

Thanks.


Edit: similar issue.

4
  • Usually the first debugging step is to try reproducing the problem with emacs -Q, which starts emacs without loading any configuration. If the problem persists, then it's a problem with emacs itself, otherwise it's something that is introduced by your configuration. This sounds like something that could happen if you have flymake or flycheck turned on, for example. – db48x Apr 26 '20 at 14:30
  • Also, you might set a breakpoint on write-region. I think most of the commands for saving files end up calling it one way or another; it's the one that actually puts bytes into a file. – db48x Apr 26 '20 at 14:36
  • Thanks a lot @db48x, I will try setting that breakpoint and report back. The current file saving is wrecking havoc with an auto-compile daemon that starts compiling over and over again, making the system quite strained. And yes, I do have flymake and flycheck enabled. However, disabling the flycheck and flymake modes seems to have no effect. – Ashesh Apr 27 '20 at 6:40
  • @db48x Setting a breakpoint on write-region has no effect on whatever is saving the haskell files. It seems to now only be triggered by unrelated modes. The messages buffer still indicates the file being written over and over again. – Ashesh Apr 27 '20 at 6:51
1

In my case, and in case anyone else using dante stumbles on this: this seems to be a feature of Dante for typechecking to work. And this was removed in favour of using temp. files as discussed in this issue. The resolution, in my case, was to upgrade dante from 1.5 -> 1.6, which doesn't have this issue. You'd want to watch out if you are a heavy user of Indirect buffers, though.

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.