* java mode won't play nice
@ 2003-05-28 12:27 Kevin Dziulko
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Dziulko @ 2003-05-28 12:27 UTC (permalink / raw)
Hello
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)
(brace-list-open)
(brace-list-close)))
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(case-label after)
(label after)
(access-label after)))
(c-cleanup-list . (scope-operator
empty-defun-braces
defun-close-semi))
(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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: java mode won't play nice
[not found] <ubrxndqmg.fsf@softechnics.com>
@ 2003-05-28 17:58 ` Kevin Dziulko
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Dziulko @ 2003-05-28 17:58 UTC (permalink / raw)
Looks interesting, but seems to be over-kill for me. I just want
indentation to behave like in c-mode, don't care about other features.
On Wed, 28 May 2003, Jeffery B. Rancier wrote:
> Kevin Dziulko <dziulko@klaatu.canisius.edu> writes:
>
> Have you looked at the JDEE at http://jdee.sunsite.dk?
>
> > Hello
> >
> > 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)
> > (brace-list-open)
> > (brace-list-close)))
> > (c-hanging-colons-alist . ((member-init-intro before)
> > (inher-intro)
> > (case-label after)
> > (label after)
> > (access-label after)))
> > (c-cleanup-list . (scope-operator
> > empty-defun-braces
> > defun-close-semi))
> > (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)
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: java mode won't play nice
[not found] <mailman.6908.1054124887.21513.help-gnu-emacs@gnu.org>
@ 2003-05-29 20:36 ` Artur Hefczyc
2003-05-30 12:14 ` Kevin Dziulko
0 siblings, 1 reply; 4+ messages in thread
From: Artur Hefczyc @ 2003-05-29 20:36 UTC (permalink / raw)
> 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.
> (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
Hm, did you try to ad your hook to java-mode-hook?
(add-hook 'java-mode-hook 'my-c-mode-common-hook)
I didn't checked this, because I use JDEE for java programming under emacs
and I do similar thing with jdee hook, which also uses java style
indentation
which is not very useful. To correct this indentation I do only something
like this:
;;; Some more customization for JDEE
(defun my-jde-mode-hook ()
(c-set-offset 'substatement-open 0)
(c-set-offset 'statement-case-open 0)
(c-set-offset 'case-label '+)
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-cont-nonempty '+)
(setq c-comment-continuation-stars "* "
c-basic-offset 4)
)
(add-hook 'jde-mode-hook 'my-jde-mode-hook)
And it works. By the way I really recommend to use JDEE for
java under emacs. I started to write emacs+jdee guide, check it
maybe you will find something interesting:
http://wttools.sourceforge.net/emacs-stuff/emacsandjdee.html
gl
Artur
--
Artur Hefczyc artur.hefczyc@plusnet.pl
Open Source Developer
http://geotools.sourceforge.net/
http://wttools.sourceforge.net/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: java mode won't play nice
2003-05-29 20:36 ` java mode won't play nice Artur Hefczyc
@ 2003-05-30 12:14 ` Kevin Dziulko
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Dziulko @ 2003-05-30 12:14 UTC (permalink / raw)
Yes, I did do the (add-hook 'java-mode-hook 'my-c-mode-common-hook). It
didn't seem to be helping me. The main problem was the block braces, {,
were not getting indented properly. Then I learned that there was some
syntacic symbol differences between c and java from the class
declarations. I added (inline-open . 0) to my-c-mode-common-hook, and now
I'm pretty much happy with the indentation of the code. Thanks to all
who've replied!
On Thu, 29 May 2003, Artur Hefczyc wrote:
> > 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.
> > (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
> Hm, did you try to ad your hook to java-mode-hook?
> (add-hook 'java-mode-hook 'my-c-mode-common-hook)
>
> I didn't checked this, because I use JDEE for java programming under emacs
> and I do similar thing with jdee hook, which also uses java style
> indentation
> which is not very useful. To correct this indentation I do only something
> like this:
> ;;; Some more customization for JDEE
> (defun my-jde-mode-hook ()
> (c-set-offset 'substatement-open 0)
> (c-set-offset 'statement-case-open 0)
> (c-set-offset 'case-label '+)
> (c-set-offset 'arglist-intro '+)
> (c-set-offset 'arglist-cont-nonempty '+)
> (setq c-comment-continuation-stars "* "
> c-basic-offset 4)
> )
> (add-hook 'jde-mode-hook 'my-jde-mode-hook)
>
> And it works. By the way I really recommend to use JDEE for
> java under emacs. I started to write emacs+jdee guide, check it
> maybe you will find something interesting:
> http://wttools.sourceforge.net/emacs-stuff/emacsandjdee.html
>
> gl
> Artur
> --
> Artur Hefczyc artur.hefczyc@plusnet.pl
> Open Source Developer
> http://geotools.sourceforge.net/
> http://wttools.sourceforge.net/
>
>
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-05-30 12:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.6908.1054124887.21513.help-gnu-emacs@gnu.org>
2003-05-29 20:36 ` java mode won't play nice Artur Hefczyc
2003-05-30 12:14 ` Kevin Dziulko
[not found] <ubrxndqmg.fsf@softechnics.com>
2003-05-28 17:58 ` Kevin Dziulko
2003-05-28 12:27 Kevin Dziulko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.