From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: ad Newsgroups: gmane.emacs.help Subject: Re: indentation in jde/java mode Date: Wed, 28 Apr 2004 19:08:57 -0400 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 1083194235 17178 80.91.224.253 (28 Apr 2004 23:17:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Apr 2004 23:17:15 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 29 01:17:06 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 1BIyIc-0003XL-00 for ; Thu, 29 Apr 2004 01:17:06 +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 1BIyIC-0001ff-2N for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Apr 2004 19:16:40 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!border1.nntp.ash.giganews.com!nntp.giganews.com!local1.nntp.ash.giganews.com!nntp.adelphia.com!news.adelphia.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Wed, 28 Apr 2004 18:07:23 -0500 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-NNTP-Posting-Host: 69.168.115.142 Original-X-Trace: sv3-3T2v2o0CJjgdSi5OCj0rKuZy1v9yUsXJuNc1XWXKUDJMUt0+j4Lxvk0tvJzFfnSRJw2pbIOGd1485Xx!y2dFqSsB9Ccn+x+X3u9Ho4PyCKFz+NcDXsAQINwx4VkQ0LLGfoo/acZLixyQFaoHNKkIak9fyTvr!Qx6D3slsC9zjJbqNUSProog= Original-X-Complaints-To: abuse@adelphia.net X-DMCA-Complaints-To: copyright@adelphia.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Original-Xref: shelby.stanford.edu gnu.emacs.help:122812 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:18100 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:18100 On Wed, 28 Apr 2004 18:02:24 +0000, Alan Mackenzie wrote: > 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! Thank you very much Alan. Now the indentation in java mode works great.