[Ns-developers] emacs indentation innamespace
Nicola Baldo
nbaldo at cttc.es
Tue Mar 31 03:20:39 PDT 2009
Hi all,
as many of you, I am using emacs for editing ns3 code. The "gnu"
indentation style mostly conforms to the ns3 coding guidelines, but has
a few quirks. One of these is that code after "namespace ns3 {" is
indented, while the ns3 coding style says it should not. This is
annoying. Does anybody out there have a solution to this problem?
My experience is:
1) with a ns3 source file already opened, you can type 'C-c C-o
innamespace <ret> 0 <ret>' and get the desired behavior
2) I tried to make the setting permanent by adding the following code to
my ~/.emacs:
(defun my-c-mode-common-hook ()
(c-set-offset 'innamespace 0))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
this works for normal C source files, but doesn't work when opening a
ns3 source code file. I think this is due to the option 'c-file-style:
"gnu";' in the emacs modeline at the beginning of the source code file:
I get the impression that it overrides the innamespace setting in
.emacs. In fact, if I remove 'c-file-style: "gnu";' from the modeline,
the next time I open the file I get the desired behavior.
Any hints? It's annoying to do procedure 1) for every file you open...
Regards,
Nicola
More information about the Ns-developers
mailing list