JT1
JT1

Reputation: 453

Switching quickly between different C styles in emacs

What is the best way to define multiple different C-styles in emacs and easily? I have one project that requires the Google C/C++ style while everything else uses BSD. What I would like to have is a key combination to allow me to quickly change between the style provided by

https://google-styleguide.googlecode.com/svn/trunk/google-c-style.el

and the standard "bsd" emacs style.

Upvotes: 1

Views: 89

Answers (1)

Chris
Chris

Reputation: 137268

Instead of a key combination, I would suggest using directory-local variables. This modified example from the documentation should work:

((c-mode . ((c-file-style . "BSD"))))

Put this into a file called .dir-locals.el in the root of your project, and adjust the value for c-file-style as necessary.

Upvotes: 2

Related Questions