From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Indenting problem Date: Thu, 24 Apr 2003 08:07:18 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1051173403 13817 80.91.224.249 (24 Apr 2003 08:36:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 24 Apr 2003 08:36:43 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 24 10:36:40 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 198btI-0002Ht-00 for ; Thu, 24 Apr 2003 10:15:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 198btI-0003Zr-02 for gnu-help-gnu-emacs@m.gmane.org; Thu, 24 Apr 2003 04:15:36 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!feed.news.nacamar.de!news.tu-darmstadt.de!news.belwue.de!informatik.tu-muenchen.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 65 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1051171479 28712 193.149.49.134 (24 Apr 2003 08:04:39 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 24 Apr 2003 08:04:39 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:112260 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8759 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8759 M Wasilewski wrote on 23 Apr 2003 22:30:58 GMT: > I seem to be having a problem with emacs indenting. Under solaris and > linux my indenting looks like so: > Vector3 cross( const Vector3 &v ) const > { > return Vector3( y * v.z - z * v.y, > z * v.x - x * v.z, <============== > x * v.y - y * v.x ); > } > No problems. But running emacs under Windows XP with the same .emacs file > gives me this: > Vector3 cross( const Vector3 &v ) const > { > return Vector3( y * v.z - z * v.y, > z * v.x - x * v.z, <============== > x * v.y - y * v.x ); > } > The z and the x are lined up with the bracket rather than the y. Does > anyone know why this is? Or more importantly how to fix it? > Thanks. You don't explicitly say so, so I'm assuming you're programming in C, or some other language handled by cc-mode. You need to use an "indentation function", in particular c-lineup-arglist, rather than just straightforward indentation. To understand this, put the cursor on the line I've marked "<====". Type C-c C-s. This will tell you something like "((arglist-cont-nonempty 1268 1282))", cc-mode's syntactic analysis of the line. (The numbers are buffer positions of important reference points.) To try out the new function, type C-c C-o on this line and accept the suggested default, "arglist-cont-nonempty", with . In place of the suggested default, type "c-lineup-arglist". Now use the key in your buffer to check that the two continuation lines do indeed indent properly. You'll want to put this into your .emacs to make it permanent. You can either attach this to "c-mode-common-hook" (when it will apply to all cc-mode languages), or to "c-mode-hook" (if you just want it to be for C). The entry will look something like this: (defun my-c-mode-common-hook () (c-set-offset 'arglist-cont-nonempty 'c-lineup-arglist) ;; other customization here. ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) This is all described in the CC-Mode info pages under "Customizing indentaion". All the best! > Mike Wasilewski -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").