Hello, The indentation in C++ mode does not seem to work properly in batch mode with the following code (indented in interactive mode): """ template Derived::Derived(): Base() // Problem: wrong indentation in batch mode. { } """ Now, define the Lisp function: (defun cpp_indent () (c-set-style "gnu") (c++-mode) (indent-region (point-min) (point-max) ()) (save-buffer) ) And apply it the previous function. It will result in: """ template Derived::Derived(): Base() // Problem: wrong indentation in batch mode. { } """ which is inconsistent with the interactive and is not, I presume, the targeted result. I found the problem in Emacs 23.0.60.1 (emacs snapshot in Kubuntu 8.04) and in Emacs 22.1.3. It does not appear in Emacs 21.4.1 (Debian Etch). Just an unrelated note about the indentation. I found a difference between the two latest versions I mentioned and the version 21.4.1. This code (indented with Emacs 22+): """ template Derived0::Derived0(): Base () { } """ is indented by Emacs 21.4.1 as """ template Derived0::Derived0(): Base () { } """ I like the new indentation better, and I suppose it was an improvement introduced in the latest versions. I mention it, just in case... I attach three files: - test.cxx: a file to be indented (but already well indented); - test-wrong_indentation.cxx: test.cxx after indentation in batch mode with Emacs 22+; - cpp_indent.lisp: the indentation function. Used in: "emacs -batch test.cxx - l cpp_indent.lisp -f cpp_indent". Thank you for your great work, Vivien Mallet.