From: "Eric Lilja" <mindcooler@gmail.com>
Subject: Indentation varies for .cc and .cpp
Date: 27 Sep 2006 00:39:59 -0700 [thread overview]
Message-ID: <1159342799.793017.283660@m7g2000cwm.googlegroups.com> (raw)
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
next reply other threads:[~2006-09-27 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-27 7:39 Eric Lilja [this message]
2006-09-27 21:30 ` Indentation varies for .cc and .cpp Eric Lilja
2006-10-11 11:41 ` Sam Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1159342799.793017.283660@m7g2000cwm.googlegroups.com \
--to=mindcooler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).