From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: How to set up a minor mode depending on a major mode? Date: Mon, 11 May 2009 13:43:17 +0200 Message-ID: <20090511114317.GA12496@tomas> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1242067026 28816 80.91.229.12 (11 May 2009 18:37:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 May 2009 18:37:06 +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 May 11 20:36:56 2009 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.50) id 1M3aMY-0006z4-98 for geh-help-gnu-emacs@m.gmane.org; Mon, 11 May 2009 20:36:30 +0200 Original-Received: from localhost ([127.0.0.1]:48241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3aMY-0005ql-26 for geh-help-gnu-emacs@m.gmane.org; Mon, 11 May 2009 14:36:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3TnC-0002SF-8n for help-gnu-emacs@gnu.org; Mon, 11 May 2009 07:35:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3Tn7-0002R2-3X for help-gnu-emacs@gnu.org; Mon, 11 May 2009 07:35:33 -0400 Original-Received: from [199.232.76.173] (port=59724 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3Tn6-0002Qz-W3 for help-gnu-emacs@gnu.org; Mon, 11 May 2009 07:35:29 -0400 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:37332 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3Tn6-0002me-Ko for help-gnu-emacs@gnu.org; Mon, 11 May 2009 07:35:28 -0400 Original-Received: by www.elogos.de (Postfix, from userid 1000) id CE0069005C; Mon, 11 May 2009 13:43:17 +0200 (CEST) Content-Disposition: inline User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Mon, 11 May 2009 14:35:02 -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:64346 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Emacs-folks I'd like to set up some minor mode whenever a major mode is switched on. I gather that the recommended method seems to be to hook into the major mode hook like so: (add-hook 'am-mode-hook '(lambda () (visual-line-mode t))) (i.e. switch visual-line-mode on whenever am-mode-hook is swiitched on). However, this doesn't work, and I have tracked it back to the standard major-mode machinery doing a (kill-all-local-variables) sweeping away whatever tidbits the minor mode needs to survive. Now I could look into the minor mode and declare every variable needed by it as 'permanent-local, but that feels quite awkward. Is there a better way? Am I missing something? Thanks - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFKCA9VBcgs9XrR2kYRAiSeAJ41OIXJiRMKZa4E4BQQunmomBNbAgCePBJh vaNli5R14hH4NKStCtxi4KA=3D =3DQoKS -----END PGP SIGNATURE-----