[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] java mode indentation

From: Carl Seghers
Subject: Re: [h-e-w] java mode indentation
Date: Mon, 13 Jun 2005 23:51:05 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Here's the c style that I use.  What I think is important for you is the
substatement-open setting:

Good luck,

(defconst my-c-style
 '((c-electric-pound-behavior        alignleft)
 (c-offsets-alist . ((arglist-close         . c-lineup-arglist)
                    (access-label          . /)
                    (inline-open           . 0)
                    (statement-case-intro  . *)
                    (statement-case-open   . *)
                    (substatement-open     . 0)     ;; <--- !!!
                    (label                 . /)
;                    (arglist-cont-nonempty . -1)
                    (case-label            . *)))
 (c-cleanup-list  . (scope-operator
;                    brace-else-brace
;                    brace-elseif-brace
;                    empty-defun-braces
 (c-hanging-braces-alist         . ((substatement-open before after)
                    (block-open before after)
                    (block-close . c-snug-do-while)))
 (c-hanging-colons-alist         . ((member-init-intro before)
                    (case-label after)
                    (label after)
                    (access-label after)))
 (c-echo-syntactic-information-p . t)
 "My Programming Style"

(c-add-style "My Style" my-c-style t)

John I. Seltzer wrote:

I'm reposting this thanks to a suggestion that it be posted in text mode:

Hi all,

I'm trying to get the following indenting style to work with emacs (NT Emacs to be specific):

public class blah

  public blah()
      if (foo)

But instead, the braces after any block internal to the method start block are indented:
public class blah

  public blah()
      if (foo)

I cannot figure out how to get the braces on the next line after if(foo) to NOT be indented.

Does anyone know which variable needs setting.
I've tried searching for this in the archives, but can't find the root of this problem.

Here are my settings in .emacs:
(defun a-java-mode-hook ()
(setq tab-width 2)
(setq indent-tabs-mode nil)
(setq-default c-basic-offset 4)

(setq c-tab-always-indent t)
(setq c-indent-level 4)
(setq c-continued-brace-offset 4)
(setq c-brace-offset -4)
(setq c-brace-imaginary-offset 0)
(setq c-argdecl-indent 4)

However, I note that even if I run emacs with no .emacs, I get the same unwanted indentation of the internal block brace.

I've tried setting to k&r style, with no luck.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]