From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: 3246251196ryan@gmail.com Newsgroups: gmane.emacs.help Subject: Re: Emacs *-mode add-hook functions (not working>) Date: Mon, 10 Nov 2014 09:37:59 -0800 (PST) Message-ID: <538edd7a-8d2c-4d19-9edf-bb99871635df@googlegroups.com> References: <83d28zrr8f.fsf@gnu.org> <13f9c811-a41d-446d-a795-932d95939a63@googlegroups.com> <2cd53f5b-d707-4362-b013-31afed98a96a@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1415641226 15025 80.91.229.3 (10 Nov 2014 17:40:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Nov 2014 17:40:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Nov 10 18:40:20 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 1Xnswt-0004m5-Sg for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Nov 2014 18:40:20 +0100 Original-Received: from localhost ([::1]:44394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnswt-0002Yd-Hi for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Nov 2014 12:40:19 -0500 X-Received: by 10.52.1.103 with SMTP id 7mr26074336vdl.6.1415641079985; Mon, 10 Nov 2014 09:37:59 -0800 (PST) X-Received: by 10.140.44.66 with SMTP id f60mr21830qga.27.1415641079924; Mon, 10 Nov 2014 09:37:59 -0800 (PST) Original-Path: usenet.stanford.edu!u7no611553qaz.1!news-out.google.com!u1ni1qah.0!nntp.google.com!i13no611813qae.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <2cd53f5b-d707-4362-b013-31afed98a96a@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.39.218.10; posting-account=yK8oPQoAAAA1qIT_h_OI91dtN6mGEacV Original-NNTP-Posting-Host: 194.39.218.10 User-Agent: G2/1.0 Injection-Date: Mon, 10 Nov 2014 17:37:59 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:208610 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:100888 Archived-At: On Monday, 10 November 2014 15:49:34 UTC, 3246251...@gmail.com wrote: > On Sunday, 9 November 2014 23:15:06 UTC, 3246251...@gmail.com wrote: > > I will test out whether or not the hook function gets called tomorrow. >=20 > Okay, the hook function is actually working which is strange. So the prob= lem remains: >=20 >=20 > That I must firstly open a C++ file in order to get CEDET to parse the he= aders. Once I do that I there is no problem opening up a .h file, it works.= However, if I start emacs and firstly open a .h file I am forced to do M-x= c-mode - but once that is done everything is fine thereafter. =20 >=20 > Just trying to figure out why this is the case. To mark this as SOLVED: I have got this working by including a simple clause in the function called= on hook. (if (string=3D "c-mode" major-mode) (progn (c++-mode))) ;; Switch C mode to C++ mode (because we use .h!) Now things just work. I also forgot failed to realise how useful it is to s= witch to C++-mode when looking at a C++ .h file: the emacs colouring is all= correct when in C++-mode, eg: static void MyStatFunc();=20 the keyword were not being read correctly, so void would be the colour of t= he method name etc. All good now with this hack, but still wondering why I needed to do M-x c-m= ode again in the first place to get things to run.