From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.help Subject: Re: Force spaces instead of tabs Date: Wed, 11 Oct 2006 02:46:01 +0300 Organization: SunSITE.dk - Supporting Open source Message-ID: <868xjnu43q.fsf@gothmog.pc> 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 1160527468 28312 80.91.229.2 (11 Oct 2006 00:44:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 11 Oct 2006 00:44:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 11 02:44:26 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 1GXS9A-0007lr-7S for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Oct 2006 02:40:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GXS99-0003bM-GE for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2006 20:40:31 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (berkeley-unix) Cancel-Lock: sha1:m0/jtHdlEG+ElpFfOqtNKt6+kuk= Original-Lines: 49 Original-NNTP-Posting-Host: 62.103.39.229 Original-X-Trace: news.sunsite.dk DXC=7CB]L^Mj72:ak; I7eU]7Gb30c[>DY7; 15oOY=>[N6> Original-X-Complaints-To: staff@sunsite.dk Original-Xref: shelby.stanford.edu gnu.emacs.help:142361 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:37982 Archived-At: On 10 Oct 2006 00:04:46 -0700, "Martin" wrote: > 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 I used the following set of local variables in files recently edited in one of the repositories I work with: // Local variables: // mode: c++ // c-basic-offset: 4 // c-tab-always-indent: t // indent-tabs-mode: nil // End: The only one that you seem to have missed is `indent-tabs-mode'. > 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? The `indent-tabs-mode' variable controls whether Emacs will use TAB characters when indenting text or program sources. Setting it to nil tells Emacs to only indent using SPC characters, as described in the documentation of this variable. Try: `C-h v indent-tabs-mode RET'. You should see something like this: ,---------------------------------------------------------------- | indent-tabs-mode is a variable defined in `C source code'. | Its value is nil | Local in buffer *followup to Martin on gnu.emacs.help*; global value is t | Automatically becomes buffer-local when set in any fashion. | | This variable is safe as a file local variable if its value | satisfies the predicate `booleanp'. | | Documentation: | *Indentation can insert tabs if this is non-nil. | Setting this variable automatically makes it local to the current buffer. | | You can customize this variable. `----------------------------------------------------------------