bradyt / dart-server

An Emacs minor mode for the Dart server
GNU General Public License v3.0
0 stars 0 forks source link

Restore format-on-save functionality #9

Closed amake closed 5 years ago

amake commented 5 years ago

In the move to the new repo, the format-on-save functionality got left out.

Currently, dart-server-format-on-save is defined but unused. It was previously used like so: https://github.com/bradyt/dart-mode/blob/e41f41e09cfeb35f3733f07c06ee8037825fb5ab/dart-mode.el#L2041

This patch restores the functionality, with some tweaks:

  1. Define a named function for performing the conditional format, so we can remove it from the hook when deactivating the minor mode
  2. Use the LOCAL argument of add-hook to make the before-save-hook buffer-local
bradyt commented 5 years ago

Merged. Thank you!