From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Lindner Newsgroups: gmane.emacs.help Subject: Activating a mode in a hook Date: Fri, 18 Jul 2014 11:03:49 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: ger.gmane.org 1405674283 1741 80.91.229.3 (18 Jul 2014 09:04:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jul 2014 09:04:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 18 11:04:36 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X845j-0000Gh-Jz for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jul 2014 11:04:35 +0200 Original-Received: from localhost ([::1]:48704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X845j-0007HE-5u for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jul 2014 05:04:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X845Q-0007GX-9f for help-gnu-emacs@gnu.org; Fri, 18 Jul 2014 05:04:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X845H-0004Qq-O3 for help-gnu-emacs@gnu.org; Fri, 18 Jul 2014 05:04:16 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:45698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X845H-0004Qi-Hj for help-gnu-emacs@gnu.org; Fri, 18 Jul 2014 05:04:07 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X845G-0008VJ-7B for help-gnu-emacs@gnu.org; Fri, 18 Jul 2014 11:04:06 +0200 Original-Received: from lapsgs09.informatik.uni-stuttgart.de ([129.69.213.139]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Jul 2014 11:04:06 +0200 Original-Received: from mailinglists by lapsgs09.informatik.uni-stuttgart.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Jul 2014 11:04:06 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lapsgs09.informatik.uni-stuttgart.de User-Agent: KNode/4.13.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98741 Archived-At: 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