No problem. Note that the (c-echo-syntactic-information-p . t) setting
will display the syntactic element at the place of the cursor when you
hit TAB. That allows you to see what setting you need to tune in your
c-style. Another tip is that if you enable auto-newline the
c-hanging-braces-alist settings below will automatically put the braces
on a new line like you prefer it, all automatically.
c ya
Carl
John I. Seltzer wrote:
Carl,
Thanks a Million. This style provided the exact format that I needed.
John
Carl Seghers wrote:
Here's the c style that I use. What I think is important for you is
the substatement-open setting:
Good luck,
Carl
(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
defun-close-semi
list-close-comma))
(c-hanging-braces-alist . ((substatement-open before after)
(block-open before after)
(brace-list-open)
(block-close . c-snug-do-while)))
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(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)
{
doSomething();
}
}
}
But instead, the braces after any block internal to the method start
block are indented:
public class blah
{
public blah()
{
if (foo)
{
doSomething();
}
}
}
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.
Thanks