Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing prelude-format-on-save setting #1421

Closed
knilink opened this issue Sep 3, 2024 · 2 comments
Closed

Confusing prelude-format-on-save setting #1421

knilink opened this issue Sep 3, 2024 · 2 comments
Labels

Comments

@knilink
Copy link

knilink commented Sep 3, 2024

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

Copy link

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed soon if no further activity occurs. Thank you for your contribution and understanding!

@github-actions github-actions bot added the stale label Jan 19, 2025
@bbatsov
Copy link
Owner

bbatsov commented Jan 23, 2025

I agree. The solution here seems pretty simple - we have make the hook function named, so it'd be easy to remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants