From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: luca.pamparana@gmail.com Newsgroups: gmane.emacs.help Subject: having problems with indentation in c++-mode Date: Sat, 7 Feb 2009 12:07:52 -0800 (PST) Organization: http://groups.google.com Message-ID: <46eb1c48-8ab2-4e62-86f4-242b8e417dcd@p37g2000yqd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1234066516 16490 80.91.229.12 (8 Feb 2009 04:15:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Feb 2009 04:15:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 08 05:16:31 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LW15p-00086V-J3 for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Feb 2009 05:16:29 +0100 Original-Received: from localhost ([127.0.0.1]:47758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LW14W-0005FA-9I for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Feb 2009 23:15:08 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!p37g2000yqd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: 82.113.106.1 Original-X-Trace: posting.google.com 1234037272 5095 127.0.0.1 (7 Feb 2009 20:07:52 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 7 Feb 2009 20:07:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p37g2000yqd.googlegroups.com; posting-host=82.113.106.1; posting-account=D3FzDwoAAABdMDXitkUrPM9nBOvcbWaj User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:166675 X-Mailman-Approved-At: Sat, 07 Feb 2009 23:13:53 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61993 Archived-At: 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