Regis Koenig wrote:
> 
> "Daniel L. Rall" a �crit :
> 
> > (setq indent-tabs-mode nil)
> 
> thanns. I've also found it on the Turbine coding convention page.
> Do you have an idea to make emacs format the code like this
> 
> if
> {
>     ...
> }
> 
> instead of
> 
> if
>     {
>         ...
>     }

Of course--let's raid my .emacs file.  :)
Here's a defun that I run for most programming languages, along with two
trivial example of calling it:

(defun my-programming-env (&optional indent-tabs-p)
  "Setup my personalized programming environment."
  ;; Persuade indention to insert tabs only in Makefile or Outline mode.
  (setq indent-tabs-mode indent-tabs-p)

  ;; Set the amount of offset used by the '+' and '-' symbols in 
  ;; c-offsets-alist.
  (setq c-basic-offset 4)

  ;; Convince Emacs to indent properly (braces flush with start of
block).
  (c-set-offset 'substatement-open 0 nil)

  ;; Turn on syntax highlighting when X is running.
  ;(if window-system (font-lock-mode-on) t)
  (font-lock-mode-on))

(defun my-makefile-mode ()
  "My standard programming environment with tab insertion capability."
  (my-programming-env 't))

  ;; My personalized programming environment.
  (my-programming-env)

It's all done using the c-set-offset defun.  You'd be able to work it
out for yourself by running M-x c-set-offset from a Java source file
wherever the indentation
isn't to your liking.  Emacs fills in the "offset type" to set based on
where your cursor is (though you can of course type in a different
section instead).  After you enter the "offset type" to set, Emacs
prompts you for a numeric "offset value".  "+" is the "default offset"
(probably 4 out of the box), and the value of this can be changed as
well.  There's probably a better way to do this (such as by setting a
"coding style"), but I haven't played with those.

Come to think of it, I should probably add this to wherever the coding
standards section is linked off of.

> > Where can I get that JDE thing?  I've heard good things about it.
> 
> I am using redhat linux. JDE is bundled with the xemacs RPMS available
> on the xemacs web (http://www.xemacs.org)

I almost always use Linux as well, but have been using GNU Emacs.  I'll
grab the environment off the other link that was posted.  Thanks!  :)


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to