unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Alan Mackenzie<none@example.invalid>
Subject: Re: indentation in jde/java mode
Date: Tue, 27 Apr 2004 06:50:09 +0000	[thread overview]
Message-ID: <1rvk6c.q5.ln@acm.acm> (raw)
In-Reply-To: pan.2004.04.27.02.15.50.622936@no-span.org

ad <as@no-span.org> wrote on Mon, 26 Apr 2004 22:15:51 -0400:
> On Mon, 26 Apr 2004 08:30:36 +0000, Alan Mackenzie wrote:

>> ad <as@no-span.org> wrote on Sun, 25 Apr 2004 23:07:01 -0400:
>>> Hi,

>>> I am running "GNU Emacs 21.3.1" in my debian box. I have the
>>> following in my ".emacs" file to use 2 char indentation for my java
>>> files:

>>> (defun my-jde-mode-hook ()
>>> 	(setq c-basic-offset 2))

>>> (add-hook 'jde-mode-hook 'my-jde-mode-hook)
>>> (add-hook 'java-mode-hook 'my-jde-mode-hook)


>>> This seems to be working fine when I edit/view files with emacs, but
>>> when I look at the files with other editors or viewers, like "less",
>>> I see the indentation is actually 8.

>>> It seems like when the file is saved, the indentation is changing to
>>> 8.

>>> Am I doing something wrong within my ".emacs"?

>> Quick question: are you sure that your indentation is done with two
>> spaces, and not with a TAB, tab-width having somehow been set to 2?

>>> Thank you.

> 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.

Sorry, I should have been more explicit.  I was thinking that those 2
spaces you're seeing might really be a TAB character.  If so, it would
look like 8 spaces in less or other editors.

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").

If this isn't the problem, then could you do "C-c C-b" from the java
buffer, to dump the internal state of java-mode.  Post that dump here,
and we'll probably be able to see what's going wrong.

-- 
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-27  6:50 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 [this message]
2004-04-28  2:55       ` ad
2004-04-28 18:02         ` Alan Mackenzie
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=1rvk6c.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).