unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Eric Lilja" <mindcooler@gmail.com>
Subject: Re: Some problems configuring emacs
Date: 25 Nov 2006 13:16:12 -0800	[thread overview]
Message-ID: <1164489372.134371.122110@j72g2000cwa.googlegroups.com> (raw)
In-Reply-To: <1164488413.636232.76140@j72g2000cwa.googlegroups.com>


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

      reply	other threads:[~2006-11-25 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-25 21:00 Some problems configuring emacs Eric Lilja
2006-11-25 21:16 ` Eric Lilja [this message]

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=1164489372.134371.122110@j72g2000cwa.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).