* Some problems configuring emacs
@ 2006-11-25 21:00 Eric Lilja
2006-11-25 21:16 ` Eric Lilja
0 siblings, 1 reply; 2+ messages in thread
From: Eric Lilja @ 2006-11-25 21:00 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Some problems configuring emacs
2006-11-25 21:00 Some problems configuring emacs Eric Lilja
@ 2006-11-25 21:16 ` Eric Lilja
0 siblings, 0 replies; 2+ messages in thread
From: Eric Lilja @ 2006-11-25 21:16 UTC (permalink / raw)
Eric Lilja skrev:
> 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)
Think I solved it by changing my-c++-mode-hook to:
(defun my-c++-mode-hook ()
; Customizations for C++ mode in CC Mode
(delete-selection-mode 1)
(set-cursor-color "Red")
(c-set-style "ellemtel") ; Default style for c++ is "gnu"
)
(add-hook 'c++-mode-hook 'my-c++-mode-hook)
The changes wasn't visible in already opened c++ files even though I
selected byte-compile-and-load. But I restarted emacs it works. Now I
need to figure out
how to change one setting in ellementel mode.
>
> 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
/ E
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-25 21:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-25 21:00 Some problems configuring emacs Eric Lilja
2006-11-25 21:16 ` Eric Lilja
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).