This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: kawa source indentation
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: Kawa List <kawa at sources dot redhat dot com>
- Cc: Wen-Chun Ni <wcn at tbcommerce dot com>
- Date: Sun, 18 May 2003 12:46:59 -0700
- Subject: Re: kawa source indentation
- References: <3EC72144.4030201@bothner.com> <20030518061418.GA8704@tbcommerce.com> <3EC731DD.6070807@bothner.com> <20030518072648.GA8743@tbcommerce.com> <3EC73A9A.4030801@bothner.com>
> 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