From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: How to whip Emacs into weird indentation rules with tabs+spaces? Date: Fri, 18 Jul 2008 03:04:54 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6cc107c0-0d4f-4165-893b-52ed43470295@z6g2000pre.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1216377684 18105 80.91.229.12 (18 Jul 2008 10:41:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jul 2008 10:41:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 18 12:42:11 2008 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 1KJnPY-0008Af-6Y for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jul 2008 12:42:04 +0200 Original-Received: from localhost ([127.0.0.1]:39981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJnOf-0003t7-8i for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jul 2008 06:41:09 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!z6g2000pre.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-NNTP-Posting-Host: 24.6.97.120 Original-X-Trace: posting.google.com 1216375495 22336 127.0.0.1 (18 Jul 2008 10:04:55 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 18 Jul 2008 10:04:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z6g2000pre.googlegroups.com; posting-host=24.6.97.120; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:160354 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:55702 Archived-At: > The question is, for C++ code, how to make Emacs insert tabs for "main > indentation" and spaces for "sub-indentation". Example: .. Maybe someone has thought this up before... but if it comes down to write your own, here's a suggestion. Tab key runs the c-indent-command in c mode. So, you might define tab to run my-own-c-indent. The command will first check if the beginning of line is a tab. If so, move to the end of white spaces and insert spaces. If the beginning of line is a not white-space, then your command can call the c indent command. you might look up the source code and borrow pieces... Xah =E2=88=91 http://xahlee.org/ =E2=98=84 On Jul 17, 5:35 pm, Juanma wrote: > Hi ... again. > > The question is, for C++ code, how to make Emacs insert tabs for "main > indentation" and spaces for "sub-indentation". Example: > > |---| =3D tab . =3D space > > |---|while ( something && > |---|........some_else ) > |---|---|then_do_something(); > > The idea is that tab goes one level further, but for same-level adjustmen= ts > only spaces should be used. > > How to force Emacs into that insanity? (no, it's not my personal choice) > > Many thanks. > -- > Juanma > > "Having a smoking section in a restaurant is like > having a peeing section in a swimming pool." > -- Edward Burr