From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: James Gregory Newsgroups: gmane.emacs.help 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 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1279168133 9613 80.91.229.12 (15 Jul 2010 04:28:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Jul 2010 04:28:53 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 15 06:28:51 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OZG3z-0002Er-Fd for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jul 2010 06:28:47 +0200 Original-Received: from localhost ([127.0.0.1]:48025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OZG3y-0005dG-Ln for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Jul 2010 00:28:46 -0400 Original-Received: from [140.186.70.92] (port=37780 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYznR-0001B8-FT for help-gnu-emacs@gnu.org; Wed, 14 Jul 2010 07:06:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYznQ-0007B2-AX for help-gnu-emacs@gnu.org; Wed, 14 Jul 2010 07:06:37 -0400 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:64700) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYznQ-0007Ac-5y for help-gnu-emacs@gnu.org; Wed, 14 Jul 2010 07:06:36 -0400 Original-Received: by bwz9 with SMTP id 9so4679848bwz.0 for ; Wed, 14 Jul 2010 04:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=tbK7k8JXXSlnOY5r+JGrmU5lSeIOh6DyT/L0hHmWvdM=; b=at5LLL2xQfZAs7rTjcpzPGCmnh9G5+F3tGQ8lOP65g684ohlPVXiwfGcE8VfIsOry8 pz1SNoYa1QyMHr5WtGrA76juMGOhqJx4pK+dOJ41k2OcDnpWoDq0ryQjQHK3Dxtjg8NT TfnPhUG6N/lRDJ5XBgvyaBatiqVnjctSXPZuU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=rzPul77Bg3y+pBxBwwnsfFJ/yry2e26i/cNwHzk4SgFyd2flgE5ksDddebSM3phkJF X86dRlk+t8dnm3qse52GS7lWYS7DczqqAwiBIEn+T5QAHUOjJA64VP/Lf5aBup5KI4LL x3quh/gqT1XXWEjv4nndFmXDM8shGGckLxg0s= Original-Received: by 10.204.163.7 with SMTP id y7mr2569193bkx.103.1279105593590; Wed, 14 Jul 2010 04:06:33 -0700 (PDT) Original-Received: by 10.204.78.141 with HTTP; Wed, 14 Jul 2010 04:06:33 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Thu, 15 Jul 2010 00:27:53 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74194 Archived-At: 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