[dev] Emacs settings (was: Midas Ad lbock tested, possibly
also usable for giapeto..)
Martin Ebourne
lists at ebourne.me.uk
Wed Aug 20 01:46:05 PDT 2003
On Tue, 19 Aug 2003, Ben Chavet <ben at chavet.net> wrote:
> Does anybody know how to set up emacs to handle the 4-space indent? The
> default
> setup on redhat uses 2 & I haven't been able to figure out how to change
> it.
> I'd just be nice not to have to worry about making sure the indentation is
> right.
I've only just started hacking horde so haven't set mine up yet, but
something like this should do you. Stick it in your .emacs.el.
c-basic-offset sets the main indent level. indent-tabs-mode prevents it using
tabs to indent. In order to get the style completely right (braces in the
right places etc) you'll want to fiddle with what's in the c-offsets-alist,
and possibly add some stuff in c-hanging-braces-alist. Check the info pages.
===
;; Add a new style
(c-add-style "horde"
'((c-basic-offset . 4)
(c-offsets-alist . ((access-label . -)
))
(indent-tabs-mode . nil)
(comment-column . 45)
(fill-column . 80)
))
;; Choose the default styles
(custom-set-variables
'(c-default-style '((java-mode . "java")
(php-mode . "horde")
(other . "gnu")
))
)
===
The c-default-style maps major mode to style. Rather than putting it in by
hand you can customise that (probably better that way). Alternatively if you
edit php of differing styles, then set the style for each buffer when you
load it (C-c .).
Hope that helps,
Martin.
More information about the dev
mailing list