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: [semi-resolved] How to set up a minor mode depending on a major mode? Date: Tue, 12 May 2009 12:45:07 +0200 Message-ID: <20090512104507.GA21268@tomas> References: <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 1242141477 11083 80.91.229.12 (12 May 2009 15:17:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 May 2009 15:17:57 +0000 (UTC) Cc: tassilo@member.fsf.org To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 12 17:17:47 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 1M3tji-0001Rw-Vo for geh-help-gnu-emacs@m.gmane.org; Tue, 12 May 2009 17:17:46 +0200 Original-Received: from localhost ([127.0.0.1]:45731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3tjg-000597-1P for geh-help-gnu-emacs@m.gmane.org; Tue, 12 May 2009 11:17:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3pMM-0005Qn-VG for help-gnu-emacs@gnu.org; Tue, 12 May 2009 06:37:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3pMI-0005P5-Ek for help-gnu-emacs@gnu.org; Tue, 12 May 2009 06:37:18 -0400 Original-Received: from [199.232.76.173] (port=54245 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3pMI-0005Ow-3c for help-gnu-emacs@gnu.org; Tue, 12 May 2009 06:37:14 -0400 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:48881 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M3pMG-0001vj-RC for help-gnu-emacs@gnu.org; Tue, 12 May 2009 06:37:13 -0400 Original-Received: by www.elogos.de (Postfix, from userid 1000) id 1798D9005C; Tue, 12 May 2009 12:45:07 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20090511114317.GA12496@tomas> 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: Tue, 12 May 2009 11:14:47 -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:64383 Archived-At: -----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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1 -> am-mode: arg=3D1 | 2 -> visual-line-mode: arg=3Dt | 2 <- visual-line-mode: t 1 <- am-mode: t =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1 -> fundamental-mode:=20 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=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFKCVMzBcgs9XrR2kYRApeUAJwNTQCuZKET5mzjRXrDsnfH2NLnqQCfWLnm OvyQADwE2oAwt2DWhWir+LU=3D =3DlYnf -----END PGP SIGNATURE-----