all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: tomas@tuxteam.de
To: help-gnu-emacs@gnu.org
Cc: tassilo@member.fsf.org
Subject: [semi-resolved] How to set up a minor mode depending on a major mode?
Date: Tue, 12 May 2009 12:45:07 +0200	[thread overview]
Message-ID: <20090512104507.GA21268@tomas> (raw)
In-Reply-To: <20090511114317.GA12496@tomas>

-----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-----




      parent reply	other threads:[~2009-05-12 10:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 11:43 How to set up a minor mode depending on a major mode? tomas
2009-05-11 22:13 ` 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 ` tomas [this message]

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

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

  git send-email \
    --in-reply-to=20090512104507.GA21268@tomas \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tassilo@member.fsf.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.