This is my code
(defun my/set-c-mode ()
(local-set-key (kbd "C-c C-c") 'compile)
(setq compilation-finish-function 'compilation-exit-autoclose-clone)
(setq c-default-style "linux")
(setq c-indent-level 8)
(setq c-brace-imaginary-offset 0)
(setq c-brace-offset -8)
(setq c-argdecl-indent 8)
(setq c-label-offset -8)
(setq c-continued-statement-offset 8))
(add-hook 'c++-mode-hook 'my/set-c-mode)
Yet it does not indent correctly. This should give me the linux style indentation, but what I get is this:
/* File: ast.cc
*
------------
*/
#include "ast.h"
#include "ast_type.h"
#include "ast_decl.h"
#include <string.h> // strdup
#include <stdio.h> // printf
Node::Node(yyltype loc) {
location = new yyltype(loc);
parent = NULL;
}
Node::Node() {
location = NULL;
parent = NULL;
}
Identifier::Identifier(yyltype loc, const char *n) : Node(loc) {
name = strdup(n);
}
Any Idea why?
c-indent-level
c-brace-imaginary-offset
c-brace-offset
c-argdecl-indent
c-label-offset
c-continued-statement-offset
are all long gone. There's no deprecation warning anymore, since they've been completely retired: therefore this code just defines them anew, without anybody consuming them.