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

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

[semi-resolved] How to set up a minor mode depending on a major mode?


From: tomas
Subject: [semi-resolved] How to set up a minor mode depending on a major mode?
Date: Tue, 12 May 2009 12:45:07 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

now I know what happens.

Some background: this am-mode is run as a minor mode because it is
hooked into the format-alist trickery: it gets a chance at a file as it
is loaded, munges it and tries to munge it back on its way out. The
format-alist trickery wants a minor mode (which actually makes sense).

But after things happen, fundamental-mode is invoked (no major mode was
set at the file load stage, I think it's just too early), wiping away
everything which hasn't protected itself. Some moons ago I taught
am-mode to put 'permanent-local on all things it needs, but for a
secondary mode, I'd have to look into it to know which variables to
mark.

So it's back to the drawing board. Perhaps I'll have to construct a
major mode to go with this minor mode (instead of fundamental mode).
This makes some sense anyway.

Any ideas as to how I could hook up this?

Here's the sequence of events when I trace the four functions
run-mode-hooks, am-mode, visual-line-mode, fundamental-mode:

  ======================================================================
  1 -> am-mode: arg=1
  | 2 -> visual-line-mode: arg=t
  | 2 <- visual-line-mode: t
  1 <- am-mode: t
  ======================================================================
  1 -> fundamental-mode: 
  1 <- fundamental-mode: nil

And to Tassilo: yes, (visual-line-mode t) does work, as tested
independently. It's this last fundamental-mode nuking away the subtle
infrastructure of visual-line-mode.

Thanks for all the insights

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKCVMzBcgs9XrR2kYRApeUAJwNTQCuZKET5mzjRXrDsnfH2NLnqQCfWLnm
OvyQADwE2oAwt2DWhWir+LU=
=lYnf
-----END PGP SIGNATURE-----




reply via email to

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