all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Activating a mode in a hook
@ 2014-07-18  9:03 Florian Lindner
  2014-07-18 13:23 ` Tassilo Horn
  2014-07-19  0:56 ` Michael Heerdegen
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Lindner @ 2014-07-18  9:03 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <mailman.5604.1405674266.1147.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2014-07-21 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18  9:03 Activating a mode in a hook Florian Lindner
2014-07-18 13:23 ` Tassilo Horn
2014-07-21 11:10   ` Suvayu Ali
2014-07-19  0:56 ` Michael Heerdegen
     [not found] <mailman.5604.1405674266.1147.help-gnu-emacs@gnu.org>
2014-07-18 20:16 ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.