all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: James Gregory <james.jrg@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Is it possible to have a global minor mode disabled whenever a  certain major mode is enabled?
Date: Wed, 14 Jul 2010 12:06:33 +0100	[thread overview]
Message-ID: <AANLkTinLqCPP2shSkjGKwGxE8LVLvrWwBC9_ohc3_dTV@mail.gmail.com> (raw)

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:

;make it a global mode, and switch it on
(defun highlight-symbol-mode-on ()
  "Turn on function `highlight-symbol-mode'."
  (highlight-symbol-mode 1))

(defun highlight-symbol-mode-off ()
  "Turn off function `highlight-symbol-mode'."
  (highlight-symbol-mode -1))

(define-globalized-minor-mode global-highlight-symbol-mode
highlight-symbol-mode highlight-symbol-mode-on)
(global-highlight-symbol-mode 1)

(add-hook 'js2-mode-hook 'highlight-symbol-mode-off)

///

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.

Thanks,

James



             reply	other threads:[~2010-07-14 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14 11:06 James Gregory [this message]
2010-07-19 18:42 ` Is it possible to have a global minor mode disabled whenever a certain major mode is enabled? Aidan Gauland

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinLqCPP2shSkjGKwGxE8LVLvrWwBC9_ohc3_dTV@mail.gmail.com \
    --to=james.jrg@gmail.com \
    --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.
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.