[Top][All Lists]

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

java mode won't play nice

From: Kevin Dziulko
Subject: java mode won't play nice
Date: Wed, 28 May 2003 08:27:26 -0400 (EDT)


I am trying to get java mode to indent and behave just like how I have 
c-mode set up.  I have not been able to find anything helpful on the web.  
I did read that "`java-mode' sets the style ... of the buffer to `java' *before*
 running the `c-mode-common-hook' or `java-mode-hook'".  Any suggestions?  
Below is my c-mode stuff from my .emacs file. 

(defconst my-c-style
  '((c-tab-always-indent        . t)
    (c-comment-only-line-offset . 0)
    (c-hanging-braces-alist     . ((substatement-open after)
    (c-hanging-colons-alist     . ((member-init-intro before)
                                   (case-label after)
                                   (label after)
                                   (access-label after)))
    (c-cleanup-list             . (scope-operator
    (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
                                   (substatement-open . 0)
                                   (case-label        . 4)
                                   (block-open        . 0)
                                   (knr-argdecl-intro . -)))
    ;;(c-echo-syntactic-information-p . t)
  "My C Programming Style")

;; Customizations for all of c-mode, c++-mode, and objc-mode
(defun my-c-mode-common-hook ()
  ;; add my personal style and set it for the current buffer
  (c-add-style "PERSONAL" my-c-style t)
  ;; offset customizations not in my-c-style
  (c-set-offset 'member-init-intro '++)
  ;; other customizations
  (setq ps-line-number 'member-init-intro)
  (setq tab-width 8
        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode nil)
  ;; we like auto-newline and hungry-delete
  (c-toggle-auto-hungry-state 1)
  ;; keybindings for all supported languages.  We can put these in
  ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
  ;; java-mode-map, and idl-mode-map inherit from it.
  (define-key c-mode-base-map "\C-m" 'newline-and-indent)
  (define-key c-mode-base-map "\C-xc" 'kill-comment)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

reply via email to

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