This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: kawa source indentation


> It's a little tricky.  Perhaps Chris Dean can advise us (and the
> list), since it seems he does use Emacs with different source bases.

Sure.  The trick is to understand the difference between tab width and
indentation offset.  Kawa always has tab width set to 8 and indentation
set to 2.  This is the GNU coding style.  As Per said: 

> the tab-width [i.e. the number of columns that a tab character in a
> file is equivalent to] is 8 (except for a few legacy files), but the
> indentation amount is 2.

If you use Emacs you can write a function to help set the indentation:

    (defun kawa-style ()
      "Change to Kawa indent style"
      (interactive)
      (c-set-style "GNU")
      (c-toggle-auto-state 1))

Leave the tab-width set to the normal value of 8.  Then just call this
function interactively by typing "M-x kawa-style RET" whenever you open
a Kawa .java file.  You can also have this function called automatically
if you keep all your kawa source files in a directory named "kawa".
Like this:

    (defun my-cc-mode-common-hook ()
      (if (string-match "[/\\]kawa[/\\]" (buffer-file-name))
          (kawa-style)))

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

This is (roughly) what I do.  Please send any other questions right
along.

Regards,
Chris Dean


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]