help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some problems configuring emacs


From: Eric Lilja
Subject: Some problems configuring emacs
Date: 25 Nov 2006 13:00:13 -0800
User-agent: G2/1.0

Hello, I mostly use emacs to code in C, C++, Java, bash scrips and SQL.
My .emacs-file is a mess and I don't understand much of it. In an
attempt to understand it better I tried to configure some CC Mode
related things. Here's a snippet from my file:

; c-mode-common-hook:
; Common hook across all languages. It's run immediately
; before the language specific hook.
(defun my-c-mode-common-hook ()
  ;; my customizations for all of c-mode and related modes
  ;;(no-case-fold-search)
  (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-c++-mode-hook ()
  ; Customizations for C++ mode in CC Mode
  (delete-selection-mode 1)
  (set-cursor-color "Red")
  (setq c-default-style "ellemtel")
  )
(add-hook 'c++-mode-hook 'my-c++-mode-hook)

First I configure some things that should be regardless of CC mode
language. That seems to work just fine. But I'm having problems with
my-c++-mode-hook. I try to set c-default-style to ellementel but it
doesn't seem to work because indentation doesn't behave the same if
just put (setq c-default-style "ellemtel") alone in the file. What I
really want to do is use ellementel indentation except for C++ access
labels. The hook seems to "run" though, becuase the cursor turns red
(however, it turns red for .c-files too, why?). Is there a better way
to see if a hook runs and why doesn't it change indentation style? Hope
I made some sense...

/ E



reply via email to

[Prev in Thread] Current Thread [Next in Thread]