[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: JDE のインデント設定について



>>>>> [meadow-users-jp : No.4315]
>>>>>  tadahiro takahashi <takahashi01.hts@xxxxxxxxxxxxxxx> さま曰く:

> これをなんとかしたいのですが
> 設定方法を教えていただけないでしょうか?

Info の CC mode の項に詳しい説明がありますよ。


> (add-hook 'jde-mode-hook
> 	  '(lambda ()
> 	    (setq c-set-offset 'xxxxx 0)
> 	   ))

> のように設定すればよいことは Web で調べてわかっています。
> どの変数に設定すればブロック文の括弧のインデントが調節できるかわかって
> いません。

> block-list-open , brace-open などで試したのですがうまくできませんでした。

おしい!

  substatement-open     0

ですね。

ウチでは Sun の Code Conventions 
<http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html>
に従うように

    if ( true ) {
        System.out.println("true");
    }

なんですが、以下のような感じで設定しています。

----------------------------------------------------------------------
(setq c-default-style
      '((java-mode . "java") (other . "gnu")))

(defconst my-java-style
  '((c-basic-offset . 4)
    (c-comment-only-line-offset . (0 . 0))
    ;; the following preserves Javadoc starter lines
    (c-hanging-comment-starter-p . nil)
    (c-offsets-alist . ((inline-open . 0)
			(topmost-intro-cont    . +)
			(statement-block-intro . +)
			(knr-argdecl-intro     . 5)
			(substatement-open     . +)
			(label                 . 0)
			(statement-case-open   . +)
			(statement-cont        . +)
			;(arglist-intro  . c-lineup-arglist-intro-after-paren)
			;(arglist-close  . c-lineup-arglist)
			(arglist-intro  . +)
			(arglist-close  . 0)
			(access-label   . 0)
			(inher-cont     . c-lineup-java-inher)
			(func-decl-cont . c-lineup-java-throws)))
    (c-hanging-braces-alist . ((brace-list-open)
			       (brace-entry-open)
			       (class-open after)
			       (inline-open after)
			       (substatement-open after)
			       (block-close . c-snug-do-while)
			       (extern-lang-open after)
			       (inexpr-class-open after)
			       (inexpr-class-close before)))
    )
  "My Java Programming Style")

(defun my-java-mode-hook ()
  (c-add-style "PERSONAL" my-java-style t)
  (setq tab-width 4)
  (define-key java-mode-map "\C-m" 'newline-and-indent))

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

--
koichiro <koichiro@xxxxxxxxxxx>