auctex
[Top][All Lists]
Advanced

[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: Tue, 12 Jan 2016 08:25:04 +0100

Hello Mosè,

I have had a look at your patch, and everything seems OK to
me.

Concerning variable `TeX-style-hook-dialect-weight-alist', its use is to
convert dialect symbols (ie `:latex', `:texinfo', etc...) into a
integer bitmap representation, so that dialect expressions (`or', `and',
and `not') are evaluated to an integer bitmap. This is done by function
`TeX-shdex-eval' (please remember shdex stands for Style Hook Dialect
EXpression).

So, functionally speaking, there is no meaning what weight you associate
to each symbol, provided that:
- weights are powers of 2 within 30bits (info "(elisp) Integer Basics"), and
- no two symbols have the same weight

Performance-wise there may be a very small impact what the order of
association cells are in variable `TeX-style-hook-dialect-weight-alist',
because function `TeX-shdex-eval' uses `assq' which finds cells in
linear time.  Initially I used this order: :latex, :texinfo, :bibtex, as
in fact I write more often LaTeX documents than Texinfo documents, and
Texinfo documents than BibTeX files. That is just my personal feeling,
not sure whether this is a widely shared order, and I doubt anyway that
there are any statistics about TeX dialect use.

Fine, idle talk: that order has a non detectable impact on
performance. Just do as you like.

BR,
   Vincent.


----------------------------------------
> From: address@hidden
> Date: Mon, 11 Jan 2016 11:37:15 +0100
> Subject: Re: [AUCTeX] Problem with latex2e style hook --- LaTeX/Texinfo 
> collision
> To: address@hidden
> CC: address@hidden
>
> Hi Vincent,
>
> 2016-01-08 12:27 GMT+01:00 Vincent Belaïche <address@hidden>:
>> Hello Mosè,
>>
>> Ok, so the way we go is to have multi-dialect hooks, and you are asking
>> "Do you think is it easy to implement specification of multiple dialects
>> in AUCTeX style files?".
>>
>> So the good news is that in the contribution which I did multi-dialect
>> style files were supported from the beginning --- because at the time
>> when I did it, I had already in mind the fact that some packages are
>> multidialects. Please, look at the TeX-add-style-hook docstring. Assume
>> that you would have the two new dialects :context and :plaintex, then
>> for pgf hook you would declare the following in place of the
>> DIALECT-EXPR argument :
>>
>> (or :latex :context :plaintex)
>
> Oh, right, I already read it! And it seems I forgot it as well ;-)
>
>> Vincent.
>>
>> PS-1: If you add new dialects, I think that the only thing to do is
>>
>> 1) To change the docstring of TeX-style-hook-dialect variable to update
>> the full list of supported dialects
>>
>> 2) To change the corresponding major-more definition, so that the
>> initialisation of the TeX-style-hook-dialect variable be done
>> accordingly.
>>
>>
>> PS-2: I don't know whether the DocTeX mode is used only for LaTeX, or is
>> there something similar for ConTeXt. In the later case, you should
>> update also the DocTeX mode definition so that the
>> TeX-style-hook-dialect variable be initialized either to :latex or
>> to :context, accordingly, or maybe we need some :doctex-latex and
>> :doctex-context dialects (I don't think so, the style hook should
>> be written in a way that they you only primitive of the AUCTeX
>> kernel, and these primitives should react accordingly whether you
>> are in DocTeX mode or not, I DocTeX is not really a dialect, but
>> rather some file polyglotting method (ie making two dialects
>> co-exist in the same file).
>
> Please, take a look at the attached patch. In particular, I'm not
> sure about the value of `TeX-style-hook-dialect-weight-alist' and the
> order of the dialects, but probably it isn't really important.
>
> Bye,
> Mosè
                                          


reply via email to

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