unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs *-mode add-hook functions (not working>)
Date: Fri, 07 Nov 2014 16:59:44 +0200	[thread overview]
Message-ID: <83d28zrr8f.fsf@gnu.org> (raw)
In-Reply-To: <c63fe43c-9bdf-4f6c-b253-06e5e5a41b3c@googlegroups.com>

> Date: Fri, 7 Nov 2014 06:18:40 -0800 (PST)
> From: 3246251196ryan@gmail.com
> 
> In order to use CEDET with Windows I need to tell semantic to append include files to search through to "the" list. In order to do this, I run a function on C++ mode. For example:
> 
> ===
> (add-hook 'c++-mode-hook 'rjd-my-semantic-load-includes)
> ===
> 
> ^^^^^ This is fine. When I load up a .cpp file the function is called and all the necessary headers are included and CEDET parses them.
> 
> However, a few lines down I have this line:
> 
> ===
> (add-hook 'c-mode-hook 'rjd-my-semantic-load-includes)
> ===
> 
> At work we do not adhere to calling C++ include files with the .hpp file extension. Our header files are .h - thus, emacs considers this to be a C style.

You could use c-mode-common-hook, then you wouldn't need 2 hooks.

> When I open a .h file however I know the hook function has not been called (and I can prove it if  you wish unless you are just happy to accept this).
> 
> What am I doing wrong with these hook functions?

I don't know.  It works for me: visiting a .h file invokes a
c-mode-hook function.  I think the answer is in your other
customizations.  IOW, try this in "emacs -Q", and if it works then,
bisect your ~/.emacs to find the culprit.



  reply	other threads:[~2014-11-07 14:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07 14:18 Emacs *-mode add-hook functions (not working>) 3246251196ryan
2014-11-07 14:59 ` Eli Zaretskii [this message]
2014-11-07 17:58   ` Stefan Monnier
     [not found]   ` <mailman.13162.1415383171.1147.help-gnu-emacs@gnu.org>
2014-11-09 23:15     ` 3246251196ryan
2014-11-10 15:49       ` 3246251196ryan
2014-11-10 17:37         ` 3246251196ryan
2014-11-10 18:39           ` Drew Adams
     [not found]           ` <mailman.13379.1415644798.1147.help-gnu-emacs@gnu.org>
2014-11-11 17:33             ` 3246251196ryan
     [not found] ` <mailman.13128.1415372413.1147.help-gnu-emacs@gnu.org>
2014-11-07 17:21   ` 3246251196ryan

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=83d28zrr8f.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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).