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: indentation in jde/java mode Date: Wed, 28 Apr 2004 18:02:24 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <1rvk6c.q5.ln@acm.acm> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1083188978 6487 80.91.224.253 (28 Apr 2004 21:49:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Apr 2004 21:49:38 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 28 23:49:23 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BIwvj-0006Rj-00 for ; Wed, 28 Apr 2004 23:49:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BIwti-00066s-PZ for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Apr 2004 17:47:18 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news2.telebyte.nl!newsfeed.stueberl.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 56 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1083188267 97449 193.149.49.134 (28 Apr 2004 21:37:47 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 28 Apr 2004 21:37:47 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:122808 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:18096 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:18096 ad wrote on Tue, 27 Apr 2004 22:55:19 -0400: > On Tue, 27 Apr 2004 06:50:09 +0000, Alan Mackenzie wrote: >>> While I am writing the code and get to the new-line and hit TAB, the >>> cursor does not move, but when I finished the line with ";" or having >>> a "." (dot) in the line (example (aClass.method), does the >>> indentation automatically, and it looks by 2 chars. I also tend to >>> use "Java -> Indent Expression" menu selection quite often which also >>> looks like indenting by 2 chars. All the indentation looks just fine >>> (2-chars) within the emacs, but opening with other editors (even >>> "less") is making it look like it was indented by 8 chars. Because of >>> this, I get some complaints from my colleagues that are using xemacs. [ .... ] >> If you put the cursor in those 2 spaces, then do "C-x =", it will tell >> you what's there. If it is indeed a TAB character, check the value of >> the Emacs variables `tab-width' and `indent-tabs-mode' (using "C-h v"). > "C-x =" says: > Char: TAB (011, 9, 0x9) point=251 of 3560 (7%) column 0 > And tab-width's value is 2 > And indent-tabs-mode's value is t Aha! There's the problem. Something in your setup is setting tab-width to 2 (by default, it's 8). This seems to be a very small tab width indeed. Could it be something in your .emacs? The question is, do you want to use TABs at all for indentation? I prefer not to, because different editors/display programs sometimes disagree on how wide a TAB should be. I suggest you change `my-jde-mode-hook' to the following: (defun my-jde-mode-hook () (setq c-basic-offset 2) (setq indent-tabs-mode nil)) That will prevent TABS being used for indentation in the future. As for the source files which already contain TABS, (the ones your colleagues are moaning about ;-), a good way to correct them is with the function `untabify': First make sure that `tab-width' is still set to 2. Load a source file and type "C-x h" to mark the buffer, then "M-x untabify" to convert the TABS to spaces. Save the file again. Violà! > Thank you so much for the help. My pleasure! -- 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").