[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible to have a global minor mode disabled whenever a cert
From: |
Aidan Gauland |
Subject: |
Re: Is it possible to have a global minor mode disabled whenever a certain major mode is enabled? |
Date: |
Tue, 20 Jul 2010 06:42:10 +1200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.24 (X11/20100329) |
James Gregory wrote:
> I have a global minor mode (highlight-symbol) that conflicts with a
> major mode (js2-mode). I have seen an alternative implementation of
> highlight symbol that doesn't conflict, but it has some issues of its
> own. I would rather just disable highlight-symbol whenever js2-mode is
> loaded, but I can't work out how to do this.
>
> I have some code like this in my init files:
>
> [snip]
>
> But though the hook at the end is called, highlight-symbol is still
> switched on in js2-mode buffers. I guess this might be because the
> global minor mode is enabled after js2-mode has already loaded? Or
> some other load-order issue.
According to the Emacs manual, major-mode hooks are run as the *last* step of
initialisation, so I'm not sure why this isn't working for you. I have an
idea that may or may not be helpful: if highlight-symbol can run hooks, have
it detect the major mode of the current buffer and disable itself. If that
doesn't work, then, as a rather crude hack, you could have your js2-mode hook
run after a short delay, but that would be unreliable, as it's time dependent.
HTH,
Aidan
signature.asc
Description: OpenPGP digital signature