[Top][All Lists]

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

Re: Menu filter triggered too early

From: Ralf Angeli
Subject: Re: Menu filter triggered too early
Date: Sat, 07 May 2005 18:44:44 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

* Stefan Monnier (2005-05-07) writes:

>> Hm, this might be a knock-out criterion for the usage of menu filters
>> or hooks in order to ask the user for a master file of a multi-file
>> LaTeX document.
> Indeed.  Why do you want to do it from a menu-filter?  It sounds like an odd
> idea to start with.

The menu holds a list of environment types which the user can use to
insert environments.  The content of this list depends on certain
LaTeX classes or packages being present in the LaTeX document.  That
means, if the document includes for example a \usepackage{paralist},
there would be compactitem, compactenum etc. in this list in addition
to the standard environments.

When the user opens a file which is part of a multi-file document and
which does not specify the master file as a local variable, she has to
be asked for the master file, in order to get this list (and other
things) right.  One could do this is soon as the file is being opened,
but this can become rather annoying if the user simply wants to look
into a couple of files without actually editing anything.

So we searched for a way to delay the question about the master file
until this information is actually needed in the editing process.  One
of these events is when the user opens the menu for inserting a LaTeX
environment or macro.

We are currently using a different approach where the question is only
asked for new files which has its own set of problems.  But IMO less
than the way via menu filters.

> Well, you may not be able to tell when it's done, but you can tell whether
> it's done at one specific place or not: add a `message' before
> easy-menu-define and another after and see whether your filter's message
> occurs between the two or not.

Okay, I did this with the example I provided, and the "Hello!" message
is displayed _after_ the message placed after the `easy-menu-define'

> In any case I guess it just takes place as part of the first redisplay after
> easy-menu-define.

Yes, the test above seems to prove this.  Thanks for the hint.


reply via email to

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