In emacs 21:
namespace Abc { namespace Def {
class X;
namespace Ghi {
class Y;
}
} }
But now in emacs 22.2.1:
namespace Abc { namespace Def {
class X;
namespace Ghi {
class Y;
}
} }
How do I get the old behaviour back? Note that I do开发者_运维问答n't want a fixed column for indentation, I want it to indent one level regardless of how many 'namespace {' the line contains.
I actually found the answer myself, in a moment of clear thinking:
(defun followed-by (cases)
(cond ((null cases) nil)
((assq (car cases)
(cdr (memq c-syntactic-element c-syntactic-context))) t)
(t (followed-by (cdr cases)))))
(c-add-style "foo"
`( ...
(c-offsets-alist
( ... )
(innamespace
. (lambda (x)
(if (followed-by
'(innamespace namespace-close)) 0 '+))))))
The '...' symbolizes other personalizations of course.
精彩评论