purcell/whitespace-cleanup-mode

Whitespace-cleanup-mode & undo-fu-session conflict

ideasman42 opened this issue · 2 comments

Our packages conflict and I'm not sure on which side this should be resolved.

  • undo-fu-session uses before-save-hook
  • whitespace-cleanup-mode is called using write-file-functions which modifies the buffer which which now doesn't match the stored undo-state.

I couldn't find much definitive about the difference between before-save-hook & write-file-functions, although this page indicates write-file-functionsis for the mechanics of file-writing, not editing the buffer before saving.

So I was wondering if there would be a reason not to use before-save-hook instead, order of execution may still be an issue - but at least in that case the minor modes could be initialized so storing undo data runs last.

The report in my repo: https://gitlab.com/ideasman42/emacs-undo-fu-session/-/issues/4

Resolved on my side as using write-file-functions seems to be the solution.

Cool, glad you figured it out.