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: Indentation varies for .cc and .cpp Date: 27 Sep 2006 00:39:59 -0700 Organization: http://groups.google.com Message-ID: <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 1159342963 26552 80.91.229.2 (27 Sep 2006 07:42:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Sep 2006 07:42:43 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 27 09:42:38 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 1GSU3r-0002h7-I2 for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2006 09:42:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GSU3r-00062q-1U for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2006 03:42:31 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!m7g2000cwm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 127 Original-NNTP-Posting-Host: 130.236.67.51 Original-X-Trace: posting.google.com 1159342804 3595 127.0.0.1 (27 Sep 2006 07:40:04 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 27 Sep 2006 07:40:04 +0000 (UTC) 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: m7g2000cwm.googlegroups.com; posting-host=130.236.67.51; posting-account=VhnPwg0AAAB7O5OQRS5Hs376X47qoQdE Original-Xref: shelby.stanford.edu gnu.emacs.help:142044 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:37664 Archived-At: 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