From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric Lilja" Newsgroups: gmane.emacs.help Subject: Re: Alter a built-in style (C++, want to change where "access labels" are placed) Date: 25 Nov 2006 14:31:29 -0800 Organization: http://groups.google.com Message-ID: <1164493889.678225.266300@f16g2000cwb.googlegroups.com> References: <1164491158.374316.302540@l39g2000cwd.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1164494471 19234 80.91.229.2 (25 Nov 2006 22:41:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2006 22:41:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 25 23:41:07 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Go6Ch-00033L-EZ for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Nov 2006 23:40:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Go6Cg-0001QV-Vf for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Nov 2006 17:40:59 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!f16g2000cwb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 66 Original-NNTP-Posting-Host: 85.194.49.108 Original-X-Trace: posting.google.com 1164493894 8696 127.0.0.1 (25 Nov 2006 22:31:34 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 25 Nov 2006 22:31:34 +0000 (UTC) In-Reply-To: <1164491158.374316.302540@l39g2000cwd.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.8.1) Gecko/20061010 Firefox/2.0,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f16g2000cwb.googlegroups.com; posting-host=85.194.49.108; posting-account=VhnPwg0AAAB7O5OQRS5Hs376X47qoQdE Original-Xref: shelby.stanford.edu gnu.emacs.help:143381 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38997 Archived-At: Eric Lilja skrev: > Hi! > Sorry for starting a new thread, hope this isn't bad netiquette. > > My question: In my C++ mode hook I set the style to "ellemtel" with > (c-set-style "ellemtel") > > I like how it indents except for where it place access labels (public, > private and protected in classes). > I want to change this behaviour but keep the rest. According to CC Mode > manual this seems very possible: > "If none of the built-in styles is appropriate, you'll probably want to > create a new style definition, possibly based on an existing style. To > do this, put the new style's settings into a list with the following > format - the list can then be passed as an argument to the function > c-add-style." > > I look at the provide sample .emacs file but I can't even make this > defconst compile and I don't know what I should do when it does. > > (defconst my-c++-style > '( > (c-offsets-alist . ((access-label . -)))) "My C++ Programming > style") > > Compiling file c:/cygwin/home/hivemind/.emacs at Sat Nov 25 22:38:59 > 2006 > .emacs:137:1:Error: End of file during parsing > > And how do I "inherit" all settings from ellementel and override the > one as constructed in the defconst? > > / E Tried this: (defconst my-c++-style "ellemtel" '( (c-offsets-alist . ((access-label . -))) ) ) ;(c-add-style "PERSONAL" my-c++-style) (defun my-c-mode-common-hook () ;; my customizations for all of c-mode and related modes (setq c-basic-offset 3) (setq-default indent-tabs-mode nil) ; Use spaces, not tabs, for indentation. (delete-selection-mode 1) ; Maybe on by default on windows and off by default on solaris? ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) (defun my-cpp-mode-hook () (c-set-style "ellemtel") ) (add-hook 'c++-mode-hook 'my-cpp-mode-hook) However, it doesn't like c-add-style: c-add-style: Wrong type argument: listp, "ellemtel" and thus I cannot test it in c-set-style Any ideas?