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: Indentation varies for .cc and .cpp Date: 27 Sep 2006 14:30:32 -0700 Organization: http://groups.google.com Message-ID: <1159392631.986082.320580@h48g2000cwc.googlegroups.com> References: <1159342799.793017.283660@m7g2000cwm.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1159393271 18494 80.91.229.2 (27 Sep 2006 21:41:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Sep 2006 21:41:11 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 27 23:41:09 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 1GSh9B-0008Q8-TU for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2006 23:40:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GSh9B-0006Tb-Bb for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2006 17:40:53 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!h48g2000cwc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 139 Original-NNTP-Posting-Host: 85.194.49.108 Original-X-Trace: posting.google.com 1159392637 21395 127.0.0.1 (27 Sep 2006 21:30:37 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 27 Sep 2006 21:30:37 +0000 (UTC) In-Reply-To: <1159342799.793017.283660@m7g2000cwm.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h48g2000cwc.googlegroups.com; posting-host=85.194.49.108; posting-account=VhnPwg0AAAB7O5OQRS5Hs376X47qoQdE Original-Xref: shelby.stanford.edu gnu.emacs.help:142065 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:37685 Archived-At: Eric Lilja skrev: > Hello, I'm trying to construct .emacs-file to be used in a course. The > emacs version in question is 21.4.1. I haven't written the original > .emacs file but I've made a few changes to it based on student input. > The course is a C++ course and some of the student use .cc to denote to > C++ files, some use .cpp. We want placement of {} to be aligned with > their opening clause: > if(some_condition) > { > // code here > } > > for(...) > { > // code here > } > > etc...emacs does this for files ending in .cpp, but for files ending in > .cc it indents the {} themselves so we get > if(some_condition) > { > // code > } > Why and how do I change this behaviour? > > Here's the .emacs-file: > > (setq default-major-mode 'text-mode) > (setq require-final-newline 1) > (setq inhibit-startup-message t) > (put 'downcase-region 'disabled nil) > > > (setq version-control t) > (setq backup-by-copying t) > (setq backup-by-copying-when-linked t) > (setq backup-by-copying-when-mismatch t) > (setq kept-new-versions 99) > (setq kept-old-versions 0) > (setq delete-auto-save-files t) > (setq trim-versions-without-asking t) > (global-set-key "\C-X\C-s" > '(lambda () (interactive) (save-buffer 16))) > > > (global-font-lock-mode t) > (setq font-lock-maximum-decoration t) > > > (set-language-environment "Latin-1") > (set-terminal-coding-system 'latin-1) > > > (setq scroll-bar-mode-explicit t) > (set-scroll-bar-mode 'right) > > > (set-background-color "White") > (set-foreground-color "Black") > (set-cursor-color "Black") > > > (custom-set-variables) > (custom-set-faces > '(font-lock-comment-face ((((class color) (background light)) > (:italic t :foreground "Firebrick")))) > '(font-lock-function-name-face ((((class color) (background light)) > (:bold t :foreground "Blue")))) > '(font-lock-keyword-face ((((class color) (background light)) > (:bold t :foreground "Black")))) > '(font-lock-string-face ((((class color) (background light)) > (:italic t :foreground "ForestGreen")))) > '(font-lock-type-face ((((class color) (background light)) > (:foreground "Blue")))) > '(font-lock-variable-name-face ((((class color) (background light)) > (:foreground "Black")))) > '(font-lock-reference-face ((((class color) (background light)) > (:foreground "ForestGreen"))))) > > > (transient-mark-mode t) > > > (show-paren-mode 1) > > > (setq next-line-add-newlines nil) > (setq line-number-mode t) > (setq column-number-mode t) > (setq-default indent-tabs-mode nil) > (setq c-basic-offset 3) > (setq display-time-day-and-date t) > (setq display-time-24hr-format t) > (display-time) > > > (if (eq window-system 'x) > (pc-selection-mode)) > > > (if (string-match "^21" emacs-version) > (progn > (tool-bar-mode -1) > (blink-cursor-mode -1))) > > > (setq foo (global-key-binding "\C-m")) > (global-set-key "\C-m" (global-key-binding "\C-j")) > (global-set-key "\C-j" foo) > > > (global-set-key [f4] 'menu-bar-mode) > > (global-set-key [f5] 'toggle-truncate-lines) > > (add-to-list 'auto-mode-alist '("\\.h$" . c++-mode)) > > ;;(setq c-default-style "stroustrup") > > (setq c-default-style "ellemtel") > > > I stripped out comments in swedish manually so they don't distract, > hope I didn't remove any non-comments by mistake (a command to that > gratefully accepted). > > / E Sorry for this shameless bump, but do anyone have any ideas at all? Since it's for a large number of students I would really like to fix this so they can use .cc or .cpp and still get proper indentation. We run solaris at the labs and as I mentioned emacs is version 21.4.1. I dont see this problem with the same .emacs file on my laptop running a recent cvs checkout of emacs. / E