help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set up a minor mode depending on a major mode?


From: tomas
Subject: How to set up a minor mode depending on a major mode?
Date: Mon, 11 May 2009 13:43:17 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

-----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ás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKCA9VBcgs9XrR2kYRAiSeAJ41OIXJiRMKZa4E4BQQunmomBNbAgCePBJh
vaNli5R14hH4NKStCtxi4KA=
=QoKS
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]