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

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

Activating a mode in a hook


From: Florian Lindner
Subject: Activating a mode in a hook
Date: Fri, 18 Jul 2014 11:03:49 +0200
User-agent: KNode/4.13.2

Hello,

Two questions about hooks. I have that piece of code:

(add-hook 'c-mode-common-hook
  (lambda()
    (c-add-style "my-cc-style"
       '("linux" (c-offsets-alist . (                                   
                    (c-basic-offset . 2)
                      (innamespace . 0)
                      (namespace-open . 0)
                      (namespace-close . 0)
                      ))) t)

    (semantic-mode 1)
    (semanticdb-enable-gnu-global-databases 'c-mode)
    (semanticdb-enable-gnu-global-databases 'c++-mode)
    (global-semantic-idle-summary-mode 1)
    (global-semantic-idle-completions-mode 1)
    (global-semantic-decoration-mode 1)
    (global-semantic-stickyfunc-mode 1)
    ))


First question: When entering c++ mode it activates my-cc-style. It works 
finde regarding the namespaces, but c-basic-offset is still 8, not 2.

c-basic-offset: Its value is 8, original value was set-from-style
Local in buffer namespace.cpp; global value is set-from-style.

c-style-alist contains: 
(("my-cc-style" "linux"
  (c-offsets-alist
   (c-basic-offset . 2)
   (innamespace . 0)
   (namespace-open . 0)
   (namespace-close . 0)))


Second question: semantic-mode will be activated when entering c++ mode but 
then it's globablly activated, how can I activate it only for specific 
modes?

Thanks!

Florian




reply via email to

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