Hello Thilo,

Rory suggested the following style of specification.  Does anyone know the
relationship between the different specifications?  More generally, how
exactly does jde do indentation, what are the dependencies?


(defconst my-c-style
  '((c-tab-always-indent . t)
    (c-offsets-alist        . ((case-label . +)
                               (topmost-intro-cont . +)
                               (arglist-intro . +)

                               (arglist-close . c-lineup-close-paren)
                               (inher-intro . *)
                               (inher-cont . c-lineup-java-inher)))
    (c-hanging-braces-alist . ((inline-open after)
                               (inline-close before after)
                               (class-open before after)
                               (class-close before after)
                               (brace-entry-open)
                               (brace-list-open)
                               (brace-list-close)
                               (brace-list-intro)
                               (substatement-open after)
                               (block-close . c-snug-do-while)
                               (inexpr-class-open after)
                               (inexpr-class-close before)))
    (c-cleanup-list         . (brace-else-brace
                               brace-elseif-brace
                               brace-catch-brace
                               brace-finally-brace
                               list-close-comma
                               defun-close-semi))
    (c-hanging-semi&comma-criteria
                            . (c-semi&comma-no-newlines-before-nonblanks
                               c-semi&comma-inside-parenlist)))
  "My C programming style")


(defun my-c-mode-common-hook ()
  (c-add-style "PERSONAL" my-c-style t))

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

Thanks,

Anthony

> -----Original Message-----
> From: Thilo Goetz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 04, 2002 12:58 PM
> To: Anthony Berglas
> Cc: [EMAIL PROTECTED]
> Subject: Re: Cannot Set Indentation 2, (setq c-basic-offset 2) broken
> 
> 
> Anthony Berglas writes:
>  > Hello All,
>  > 
>  > I want to set the basic indentation to be two characters 
> rather than 4.  Is
>  > this possible using JDE?  The following used to sort of 
> work, but the hook
>  > did not appear to fire -- I had to explicitly call 
> ajb-jde-mode-hook
>  > whenever I visited a new buffer.
>  > 
>  > (defun ajb-jde-mode-hook ()
>  >   (interactive)
>  >   (message "ajb-jde-mode-hook function executed")
>  >   (setq c-basic-offset 2)
>  > )
>  > (add-hook 'jde-mode-hook 'ajb-jde-mode-hook)
>  > 
>  > Then it mysteriously failed to work altogether!
>  > 
>  > Is there a better way?
>  > 
>  > Thanks,
>  > 
>  > Anthony
> 
> I have the following in my init file.  This works for me in jde
> 2.2.8.  No idea if this is the proper way to do it.
> 
> (add-hook 'c-mode-common-hook '(lambda ()
>                                  (setq indent-tabs-mode nil)
>                                  (setq tab-width 2) ;; for 
> imported code
>                                (setq c-basic-offset 2)
>                                  (c-set-offset 'substatement-open 0)
>                                  (c-set-offset 'statement-case-open 0)
>                                  (c-set-offset 'case-label '+)
>                                  (c-set-offset 'arglist-intro '+)
>                                  ))
> 
> HTH,
> Thilo
> 

Reply via email to