help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

having problems with indentation in c++-mode


From: luca . pamparana
Subject: having problems with indentation in c++-mode
Date: Sat, 7 Feb 2009 12:07:52 -0800 (PST)
User-agent: G2/1.0

Hello everyone,

I would like to set the indentation level to 4 characters and I am
having trouble achieving this in the c++-mode. I have looked on the
web and used the most common template that is found but the smart
indentation always indents at 2 spaces...no matter what I set the tab-
width or the indent level.

The relevant bits of my .emacs file are:

(defun my-c++-mode-hook ()
;;  (setq-default indent-tabs-mode nil)
  (setq tab-width 4)
  (define-key c++-mode-map "\C-m" 'reindent-then-newline-and-indent)
  (define-key c++-mode-map "\C-ce" 'c-comment-edit)
  (setq c++-auto-hungry-initial-state 'none)
  (setq c++-delete-function 'backward-delete-char)
  (setq c++-tab-always-indent t)
  (setq tab-stop-list '(4 8 12 16))

  (setq c-indent-level 4)
  (setq c-continued-statement-offset 4)
  (setq c++-empty-arglist-indent 4))


;; Add all of the hooks...
(add-hook 'c++-mode-hook 'my-c++-mode-hook)
(add-hook 'c++-mode-hook 'turn-on-auto-fill)
(setq default-major-mode 'c++-mode)

I can set the tab-width or the indent-level to whatever number but it
does not help. It always indents at 2 spaces.

I am an emacs newbie, so I am sure I have missed something basic. I
would be grateful for any help you might give me.

Cheers,
Luca


reply via email to

[Prev in Thread] Current Thread [Next in Thread]