unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tomas@tuxteam.de
To: help-gnu-emacs@gnu.org
Subject: How to set up a minor mode depending on a major mode?
Date: Mon, 11 May 2009 13:43:17 +0200	[thread overview]
Message-ID: <20090511114317.GA12496@tomas> (raw)

-----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	other threads:[~2009-05-11 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 11:43 tomas [this message]
2009-05-11 22:13 ` How to set up a minor mode depending on a major mode? Lennart Borgman
2009-05-12  6:43   ` Tassilo Horn
     [not found]   ` <791153ba0905111408m6d4b36f4hfbf86b6290b9e75c@mail.gmail.com>
2009-05-12  9:11     ` Pilot error [was: How to set up a minor mode depending on a major mode?] tomas
2009-05-12 10:45 ` [semi-resolved] How to set up a minor mode depending on a major mode? tomas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20090511114317.GA12496@tomas \
    --to=tomas@tuxteam.de \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).