From: Dave Lawrence <dgl@integrinautics.com>
Cc: emacs help <help-gnu-emacs@gnu.org>
Subject: Re: how to set c-offsets-alist
Date: Fri, 21 Jun 2002 09:25:31 -0700 [thread overview]
Message-ID: <3D13537B.6CF03BB8@integrinautics.com> (raw)
In-Reply-To: 20020621132626.18534.qmail@web20308.mail.yahoo.com
Subhakar K S wrote:
> How do I set the values for various c/c++ syntactic
> symbols using "c-offsets-alist".
>
> I want to set this values in my ~/.emacs file.
I have a similar question... is there a way to set c-offsets-alist on a
file-by-file basis
using the headline comments (or whatever they are called) like this:
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*/
>
>
> Any example peice of ~/.emacs will be helpful for
> me to copy paste.
>
Here is an example .emacs I found at :
http://cc-mode.sourceforge.net/cc-mode.html
;; Here's a sample .emacs file that might help you along the way. Just
;; copy this region and paste it into your .emacs file. You may want to
;; change some of the actual values.
(defconst my-c-style
'((c-tab-always-indent . t)
(c-comment-only-line-offset . 4)
(c-hanging-braces-alist . ((substatement-open after)
(brace-list-open)))
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(case-label after)
(label after)
(access-label after)))
(c-cleanup-list . (scope-operator
empty-defun-braces
defun-close-semi))
(c-offsets-alist . ((arglist-close . c-lineup-arglist)
(substatement-open . 0)
(case-label . 4)
(block-open . 0)
(knr-argdecl-intro . -)))
(c-echo-syntactic-information-p . t)
)
"My C Programming Style")
;; offset customizations not in my-c-style
(setq c-offsets-alist '((member-init-intro . ++)))
;; Customizations for all modes in CC Mode.
(defun my-c-mode-common-hook ()
;; add my personal style and set it for the current buffer
(c-add-style "PERSONAL" my-c-style t)
;; other customizations
(setq tab-width 8
;; this will make sure spaces are used instead of tabs
indent-tabs-mode nil)
;; we like auto-newline and hungry-delete
(c-toggle-auto-hungry-state 1)
;; keybindings for all supported languages. We can put these in
;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
(define-key c-mode-base-map "\C-m" 'c-context-line-break)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
I hope that helps...
Cheers...
Dave
next prev parent reply other threads:[~2002-06-21 16:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-21 13:26 how to set c-offsets-alist Subhakar K S
2002-06-21 16:25 ` Dave Lawrence [this message]
2002-10-18 20:07 ` setting c-offsets-alist variables from "headline"? Dave Lawrence
[not found] ` <mailman.1034971655.16649.help-gnu-emacs@gnu.org>
2002-10-18 20:19 ` Michael Slass
2002-06-21 17:27 ` how to set c-offsets-alist Chuck Bernard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D13537B.6CF03BB8@integrinautics.com \
--to=dgl@integrinautics.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.