* how to set c-offsets-alist
@ 2002-06-21 13:26 Subhakar K S
2002-06-21 16:25 ` Dave Lawrence
2002-06-21 17:27 ` how to set c-offsets-alist Chuck Bernard
0 siblings, 2 replies; 5+ messages in thread
From: Subhakar K S @ 2002-06-21 13:26 UTC (permalink / raw)
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.
Any example peice of ~/.emacs will be helpful for
me to copy paste.
thanks,
Subhakar.
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to set c-offsets-alist
2002-06-21 13:26 how to set c-offsets-alist Subhakar K S
@ 2002-06-21 16:25 ` Dave Lawrence
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-06-21 17:27 ` how to set c-offsets-alist Chuck Bernard
1 sibling, 2 replies; 5+ messages in thread
From: Dave Lawrence @ 2002-06-21 16:25 UTC (permalink / raw)
Cc: emacs help
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to set c-offsets-alist
2002-06-21 13:26 how to set c-offsets-alist Subhakar K S
2002-06-21 16:25 ` Dave Lawrence
@ 2002-06-21 17:27 ` Chuck Bernard
1 sibling, 0 replies; 5+ messages in thread
From: Chuck Bernard @ 2002-06-21 17:27 UTC (permalink / raw)
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.
>
> Any example peice of ~/.emacs will be helpful for
> me to copy paste.
>
> thanks,
> Subhakar.
Here is my example from my .emacs file. Read the comment to learn more
about customizing the values.
//Chuck
;If you go to a line in a c++ file and type C-c C-o it will tell you the name
;of the syntactic symbol to use in c-set-offset (or below in the list).
(setq c-style-alist
(append '(("ETX"
(c-basic-offset . 2)
(c-comment-only-line-offset . 0)
(c-hanging-braces-alist
(substatement-open before after))
(c-offsets-alist (topmost-intro . 0)
(topmost-intro-cont . 0)
(substatement . +)
(substatement-open . 0)
(case-label . +)
(friend . -)
(access-label . -)
(inclass . 4)
(inline-open . 0))))
c-style-alist))
(setq c-default-style "ETX")
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 5+ messages in thread
* setting c-offsets-alist variables from "headline"?
2002-06-21 16:25 ` Dave Lawrence
@ 2002-10-18 20:07 ` Dave Lawrence
[not found] ` <mailman.1034971655.16649.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Dave Lawrence @ 2002-10-18 20:07 UTC (permalink / raw)
Is there a way to set c-offsets-alist on a file-by-file basis
using "headline comments" (or whatever they are called) like this:
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*/
For example, is there any was to set defun-block-intro to 1
(as is done in a .emacs file entry below) using comments in a file?
(c-offsets-alist . ((arglist-close . c-lineup-arglist)
(substatement-open . 0)
(case-label . 4)
(block-open . 0)
(defun-block-intro . 1)
(knr-argdecl-intro . -)))
Thanks!!!
Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: setting c-offsets-alist variables from "headline"?
[not found] ` <mailman.1034971655.16649.help-gnu-emacs@gnu.org>
@ 2002-10-18 20:19 ` Michael Slass
0 siblings, 0 replies; 5+ messages in thread
From: Michael Slass @ 2002-10-18 20:19 UTC (permalink / raw)
Dave Lawrence <dgl@integrinautics.com> writes:
>Is there a way to set c-offsets-alist on a file-by-file basis
>using "headline comments" (or whatever they are called) like this:
>/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
>*/
>
>For example, is there any was to set defun-block-intro to 1
>(as is done in a .emacs file entry below) using comments in a file?
>
> (c-offsets-alist . ((arglist-close . c-lineup-arglist)
> (substatement-open . 0)
> (case-label . 4)
> (block-open . 0)
> (defun-block-intro . 1)
> (knr-argdecl-intro . -)))
>
>Thanks!!!
>
> Dave
>
>
Check out the "Local Variables in Files" node of the emacs manual:
C-h i m emacs <RET> m file <spc> variables <RET>
--
Mike Slass
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-10-18 20:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-21 13:26 how to set c-offsets-alist Subhakar K S
2002-06-21 16:25 ` Dave Lawrence
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).