Hi,
>Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
>Delivered-To: mailing list [EMAIL PROTECTED]
>X-Sender: [EMAIL PROTECTED]
>Date: Wed, 14 Jun 2000 14:25:39 -0400
>To: [EMAIL PROTECTED]
>From: Paul Kinnucan <[EMAIL PROTECTED]>
>Subject: Re: setting basic offset (indentation)
>Cc: Rick Leir <[EMAIL PROTECTED]>
>Mime-Version: 1.0
>
>At 01:15 PM 6/14/00 -0400, you wrote:
>>Another way (don't know if it is kosher) is:
>>(setq default-tab-width 2)
>>
>>Or, from Ingo's .emacs file:
>>;; Sets the basic indentation for Java source files
>>;; to two spaces.
>>(defun my-jde-mode-hook ()
>> (setq c-basic-offset 2))
>>(add-hook 'jde-mode-hook 'my-jde-mode-hook)
>>
>>Myself, I like a setting of 4.
>>cheers -- Rick
>>
>
>This is one of the most frequently asked questions on comp.emacs and
>gnus.emacs.help as well on this list. Interestinly, though setting the
>basic offset in the jde mode hook function works, you actually can set
>c-basic-offet at the top level of your .emacs file if you also set
>c-default-style appropriately at the top leve, e.g.,
>
>(setq c-default-style '((jde-mode . "user") (other . "user")))
>(setq c-basic-offset 2)
>
>Note: the above is untested code based on my reading of the doc, which says
>that all style settings made at the top level of your .emacs file are added
>to the "user" style.
Tested. Works.
GNU Emacs 20.6.1 (sparc-sun-solaris2.7, X toolkit) of Tue Jun 13 2000
I like indent 2. Thanks.
Latchezar
>
>This is all documented in the cc-mode doc though not with the greatest
>clarify. I include the relevant Emacs doc below.
>
>- Paul
>
>Excerpted from the online Emacs doc:
>----------------------------------------------------------------------------
>-------------
>c-default-style: [Hide] [Value Menu] String: user
> [State]: this option has been set and saved.
>Style which gets installed by default when a file is visited. [Hide]
>
>The value of this variable can be any style defined in
>`c-style-alist', including styles you add. The value can also be an
>association list of major mode symbols to style names.
>
>When the value is a string, all CC Mode major modes will install this
>style by default, except `java-mode', which always installs the
>"java" style (this is for backwards compatibility).
>
>When the value is an alist, the named style is installed. If the
>major mode is not listed in the alist, then the symbol `other' is
>looked up in the alist, and if found, the associated style is used.
>If `other' is not found in the alist, then "gnu" style is used.
>
>Note that if you set any CC Mode variables in the top-level of your
>.emacs file (i.e. *not* in a hook), these get incorporated into the
>`user' style, so you would need to add:
>
> (setq c-default-style '((other . "user")))
>
>to see your customizations. This is also true if you use the Custom
>interface -- be sure to set the default style to `user'.
>
>Finally, the default style gets installed before your mode hooks run,
>so you can always override the use of `c-default-style' by making
>calls to `c-set-style' in the appropriate mode hook.
>
Latchezar Dimitrov Wake Forest University, Winston-Salem, NC
home: (336) 794-2094 grad.lab: (336) 758-4954
mailto:[EMAIL PROTECTED] http://www.wfu.edu/~dimil01g
"A computer lets you make more mistakes faster than
any invention in human history--with the possible
exceptions of handguns and tequila."
--Mitch Ratliffe, "Technology Review"