all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie<none@example.invalid>
Subject: Re: indentation in jde/java mode
Date: Wed, 28 Apr 2004 18:02:24 +0000	[thread overview]
Message-ID: <gjro6c.q5.ln@acm.acm> (raw)
In-Reply-To: pan.2004.04.28.02.55.13.538492@no-span.org

ad <as@no-span.org> 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").

  reply	other threads:[~2004-04-28 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-26  3:07 indentation in jde/java mode ad
2004-04-26  8:30 ` Alan Mackenzie
2004-04-27  2:15   ` ad
2004-04-27  6:50     ` Alan Mackenzie
2004-04-28  2:55       ` ad
2004-04-28 18:02         ` Alan Mackenzie [this message]
2004-04-28 23:08           ` ad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gjro6c.q5.ln@acm.acm \
    --to=none@example.invalid \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.