Ray Kinsella <[email protected]> writes:
Hi Chris, How does it differ from what is already available in extras. https://git.fd.io/vpp/tree/extras/emacs/fix-coding-style.el Is it the extra hook that triggers the functionality on save.
It looks like that file is adding those "INDENT-OFF/INDENT-ON" pairs around various coding patterns used by VPP. My thing runs the buffer through the actual "indent" command (which is what VPP checkstyle is going to do) just prior to saving, and then it does it again. If the results are the same it changes the buffer to that result which is then saved. If the results are different it leaves the buffer (which is then saved) and it opens an error buffer with the diff between the two indent runs, as something in the code is giving the "indent" tool problems and probably needs to be wrapped in INDENT-OFF/INDENT-ON pair by hand. FWIW, Emacs go-mode has this too, it can run the code through go-fmt prior to saving. You get used to this very quickly (i.e., write a bit of code not caring too much about indent, save, watch the buffer fix itself, or become odd looking which shows you immediately you forgot a ";" or something similar :). Didn't know about that emacs dir, BTW. :) Thanks, Chris.
Ray K On 19/05/2019 17:43, Christian Hopps wrote:Hi vpp-devs, Having gotten bit by a checkstyle failure on my first submission, I decided to port the "go-like" functionality of auto-formatting the file (using indent since that's what vpp uses) on file save in Emacs.. Here's the lisp https://gist.github.com/choppsv1/c45a857ced56d4f9713eb7a555cfba2d in case anyone would find it useful too. Personally, I like clang-format better (as it appears to have deterministic results), but that's not what the project chose. :) FWIW, it only does the re-format on save if the file contains the magic string: "fd.io coding-style-patch-verification: ON" Thanks, Chris. -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#13089): https://lists.fd.io/g/vpp-dev/message/13089 Mute This Topic: https://lists.fd.io/mt/31675798/675355 Group Owner: [email protected] Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
signature.asc
Description: PGP signature
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#13096): https://lists.fd.io/g/vpp-dev/message/13096 Mute This Topic: https://lists.fd.io/mt/31675798/21656 Group Owner: [email protected] Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
