From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hadron Quark Newsgroups: gmane.emacs.help Subject: Re: Force spaces instead of tabs Date: Tue, 10 Oct 2006 13:43:18 +0200 Message-ID: <87u02cieg9.fsf@gmail.com> References: <1160463886.894724.96810@i42g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1160484094 12910 80.91.229.2 (10 Oct 2006 12:41:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Oct 2006 12:41:34 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 10 14:41:30 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GXGuP-0003OT-2s for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2006 14:40:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GXGuO-0006s6-Eb for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2006 08:40:32 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 74 Original-X-Trace: individual.net zwvMHYxwNFspcz2zMbWABgr68cjvJlxgHqz2k+wRrR6N9zcy+x X-Orig-Path: news.ibm.net!news X-Face: 2h#||Cd#d%F*NCm59[_6/{1a@jy%; |j>{D~4^gKg(^i%7j0IK?+,/GmW&:CD5fEKb_! Cancel-Lock: sha1:u/X0WUFDn6fvAFf4b06r5qj8bjM= Original-Xref: shelby.stanford.edu gnu.emacs.help:142341 Original-To: help-gnu-emacs@gnu.org 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:37962 Archived-At: "Martin" writes: > I need to have emacs indent C++ code using only spaces, and no tab > characters. > > I edited the options in the Programming/Languages/C group so that: > C Basic Offset is 3 > C Tab Always Indent is "always indents" > C Insert Tab Function is "insert-tab" > C Syntactic Indentation is non-nil > C Offsets Alist: substatement-open is 0 > > In many cases, the indentation is correct, but when I have several > levels of sub-statements, tab characters are inserted anyway. See the > example below. What other options control this behaviour? > > void B::e() > { > if () > { > ; > if () > { > ; // tab character at beginning of this line! > } > ; > } > } > My C programming .el file has the following section - the 6th line is probably what you are looking for - (setq indent-tabs-mode nil). ,---- | (defun my-c-mode-common-hook () | (c-set-style "K&R") ; offset customizations not in my-c-style | (setq tab-width 3) ;; change this to taste, this is what K&R uses :) | (my-build-tab-stop-list tab-width) | (setq c-basic-offset tab-width) | (setq indent-tabs-mode nil) | | (defun find-tag-noconfirm () | (interactive) | (find-tag (find-tag-default))) | | (defun find-tag-repeat () | (interactive) | (find-tag nil t nil)) | | (defun jump-man-page () | (interactive) | (manual-entry (current-word))) | | (setq Man-notify-method 'newframe) | | (let ((dl '( | ([f1] . jump-man-page) | ([f5] . find-tag-noconfirm) | ([f6] . find-tag-repeat) | ([f7] . pop-tag-mark) | ([f2] . gdb-restore-windows) | ([f10] . compile) | ([f11] . next-error) | ([f12] . gdba)))) | (dolist (i dl) | (define-key c-mode-map (car i) (cdr i)))) | ) | | (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) `---- The last line is probably of interest to you. --