bbatsov/prelude

Confusing `prelude-format-on-save` setting

Opened this issue · 0 comments

Hi, having been using this config for nearly a decade, thank you for creating and maintaining this project and i very appreciate it.

It's not a bug but more like a usability issue which my prettier-mod's format-on-save kept getting overrided by tide and (remove-hook 'before-save-hook 'tide-format-before-save) didn't stop it from happening. I spent quite sometime investigating an wrong direction until I global search the entire config and discover that it's because the function is wrapped with lambda.

;; formats the buffer before saving
(add-hook 'before-save-hook
(lambda ()
(when prelude-format-on-save
(tide-format-before-save))))

prelude-format-on-save seems to only work with prelude-ts and I think this feature is more like a "personal" config, and if we do want to keep this feature, a toggle function to add/remove the hook, instead of a boolean value, would probably be a better approach.

related issue #1254

Expected behavior

(remove-hook 'before-save-hook 'tide-format-before-save t) should disable tide-format-before-save

Actual behavior

It doesn't