From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dave Lawrence Newsgroups: gmane.emacs.help Subject: Re: how to set c-offsets-alist Date: Fri, 21 Jun 2002 09:25:31 -0700 Organization: IntegriNautics Corporation Sender: help-gnu-emacs-admin@gnu.org Message-ID: <3D13537B.6CF03BB8@integrinautics.com> References: <20020621132626.18534.qmail@web20308.mail.yahoo.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1024677054 4716 127.0.0.1 (21 Jun 2002 16:30:54 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 21 Jun 2002 16:30:54 +0000 (UTC) Cc: emacs help Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17LRJG-0001Dp-00 for ; Fri, 21 Jun 2002 18:30:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17LRIk-00081I-00; Fri, 21 Jun 2002 12:30:22 -0400 Original-Received: from smtp.integrinautics.com ([204.247.117.11]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17LRFd-0007oR-00 for ; Fri, 21 Jun 2002 12:27:09 -0400 Original-Received: from integrinautics.com (endor.integrinautics.com [192.168.117.115]) by smtp.integrinautics.com (8.9.3/8.9.3) with ESMTP id JAA19484; Fri, 21 Jun 2002 09:27:06 -0700 (PDT) X-Mailer: Mozilla 4.79 [en] (X11; U; Linux 2.4.18-4 i686) X-Accept-Language: en Original-To: Subhakar K S Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:506 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:506 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