1

I have this in my .emacs:

(c-set-offset 'inline-open 0)

Is there a way to "unset" inline-open in a modeline so that for some files inline-open does cause an indentation?

Thanks.

MK.
  • 3,907
  • 5
  • 34
  • 46
  • Does [this post](http://stackoverflow.com/questions/14668744/emacs-indent-for-c-class-method) help with what you wanted to do? Looks like you can specify the setting per mode... or am I missing something? – Tim S. Jul 13 '15 at 19:21
  • That basically says what I am doing in my .emacs. I want to be able to override that setting on a per file basis by specifying a modeline. For tab widths, for e.g., I can override by this modeline : /* -\*- tab-width: 2 -\*- */ – MK. Jul 17 '15 at 05:20

1 Answers1

0

You can accomplish this with file variables like you suspect. Either at the top, or at the bottom.

To do this at the top, add:

// -*- eval: (setq c-offsets-alist (assq-delete-all 'inline-open c-offsets-alist)) -*-

at the top of your file.

Alternatively, you can add it at the end of your file in a slightly different format.

// Local Variables:
// eval: (setq c-offsets-alist (assq-delete-all 'inline-open c-offsets-alist))
// End:

Note: Emacs will ask you the first time you open a file with this kind of trickery, and if you answer !, Emacs will automatically add this code to the list of things that are considered "safe" in file local variables. It will set safe-local-variable-values in your .emacs.customization.el file.

Note 2: The snippets of code are using C++ style comments, adjust appropriately if you need C comments, or some other comment scheme.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229