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