[Top][All Lists]

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

Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo collision

From: Vincent Belaïche
Subject: Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo collision
Date: Sat, 16 Aug 2014 07:04:21 +0200

Let us answer to this one now...


> > +context only, or a vector [TeX-style-hook HOOK-FUN CONTEXT] where
> > +HOOK-FUN is the hook function to be run, and CONTEXT is a symbol
> > +defining in which context the hook function may be run.
> Why [TeX-style-hook HOOK-FUN CONTEXT] and not simply [HOOK-FUN

I agree that just [HOOK-FUN CONTEXT] suffices for now. However adding
the 'TeX-style-hook header --- where here `header' stands for `a symbol
in aref 0' --- seemed to me like making it more future-proof. Vectors
can be used for many other things, please note that for instance eieio
objects are in fact vectors, with an 'object header: that inspired me.

BTW, I later thought that is may be useful to have more elements in the
vector to specify what caused the addition of the hook. For instance
that would now be


where ORIGINATOR-TAG would be some symbol, indicating how the hook was
created, e.g. 'TeX-normal-mode would indicated that the hook was
automatically created (not added programmatically) and
ORIGINATOR-SIGNATURE would be some other information that is proper to
the originator, like the source file full path over which
TeX-normal-mode was run when ORIGINATOR-TAG = 'TeX-normal-mode

That additional information would allow to replace *ONLY* the hook
function in TeX-style-hook-list that is of concern --- rather than
redefining the full style --- when you run `TeX-normal-mode' several
times, or when you load several times your init file, or any such thing
causing the addition of a hook.

Also in the auto/myfile.el generated automatically there should be some
sepecial comment with marking the originator so the full file is not
overwritten in any case --- just imagine that I have myfile.tex and
myfile.texi in the same directory...

There could be some special ORIGINATOR-TAG that would cause overwritting
the style full hook list, that might be for backward compatibility.

> > +(defvar TeX-style-hook-context nil
> > + "Context for running hooks locally to the considered file.
> > +May take two values:
> > +
> > +* 'nil' for non-Texinfo files
> > +* ':texinfo' for Texinfo files.
> I think, I'd like it more if there was an explicit :latex context
> instead of just nil. Maybe, at some point we will also want to have a
> :context context for ConTeXt.

I agree it would be better, but when I submitted that patch I was not
sure how it would be greated by people. I feared some reaction like "Oh,
you are going to cause many changes just for those few who write Texinfo
documents". So I tried to make it as conservative as possible for
non-Texinfo users.

> I'm not sure about the calling conventions. Right now, the context in
> your functions is optional and when omitted it means "everywhere
> except for texinfo". I'm not sure if that's the best semantics in the
> longer term. IMHO, it would be more logical with the meaning
> nil => in every context (like it's now)
> :latex => only in the latex context
> (:latex :texinfo) => only in the latex or texinfo contexts

I agree, but it would be better to have (or :latex :texinfo) with the
'or header just for futureproofness, ;-).

> Maybe even a negation would be useful, e.g.,
> (not :texinfo) => in any context except texinfo

I also agree that may be useful and therefore is needed.

> Of course that would mean that most if not all styles need to be
> changed to call
> (TeX-add-style-hook "thestyle" (lambda () ...) :latex)
> but that's just a one-time effort.

Good news that such an effort is acceptable.


> Bye,
> Tassilo


reply via email to

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