I'm getting this very strange behavior while using olivetti: when calling save-buffer the display goes back to the left margin, as if olivetti has stopped working. If I call olivetti-mode, it shows that it's still enabled, and it stays to the left until I zoom in or out (ctrl-+ on doom). I only get this behavior in org buffers..

Is it possible that there's an after-save-hook that only runs in org mode? how can I check that?


  • You could try C-h v after-save-hook RET and see the value of the hook, if that's where the problem could be. Commented May 19, 2021 at 11:16
  • thanks! I have: (+vc-gutter-init-maybe-h org-roam-db-update org-roam--handle-title-change flycheck-handle-save t ws-butler-after-save) non of which look suspicious Commented May 20, 2021 at 12:07
  • You say you are using Doom. Does olivetti behaves the same from emacs -Q? If so, you should report it as a bug at github.com/rnkn/olivetti Commented May 21, 2021 at 9:06

1 Answer 1


I experienced a similar issue in Doom Emacs. In my case, When I edited .mdx file in olivetti-mode and used the save-buffer command, Emacs would exits olivetti-mode.

After I switched from 'fundamental-mode' to 'text-mode', the issue disappeared.

I managed to gather some clues by enabling debug-on-entry on the set-window-margin function, which is called by olivetti-mode.

Following this, Emacs entered debugger mode, presenting a backtrace associated with the doom-guess-mode-h function.

I suspect that Doom Emacs is attempting to determine the most suitable major mode for the buffer when it is in fundamental mode.

I hope this helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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