auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Add `unit' type for the parser in siunitx.el


From: Mosè Giordano
Subject: Re: [AUCTeX-devel] Add `unit' type for the parser in siunitx.el
Date: Wed, 13 Feb 2013 17:48:26 +0100

Hi Tassilo,

2013/2/13 Tassilo Horn <address@hidden>:
>> The idea of using `TeX-auto-store-pre-string' came to me when thinking
>> about a way to store in parsed file the options given to packages at
>> load time.
>
> I don't see how storing package options is related to your
> `TeX-auto-store-pre-string'.
My idea (just an idea, no code for now) was to create a variable,
`LaTeX-<package>-provided-package-options' as you suggested, and write
it to parsed file using `TeX-auto-store-pre-string'.  Maybe, a proof
of concept by me can make it clearer.

By now, the only information written to parsed file are those in
`TeX-auto-parser'.  The `TeX-auto-store-pre-string' workaround would
allow style file authors to write in parsed file also arbitrary code.
This code may contain information that should be remembered between
sessions (eg, the definition of a new type for the parser, as in my
original code) or for some other purposes I can't foresee.

>> Do you have alternative suggestions for this?
>
> IMO, it would make sense to simply discard all auto-parsed information
> in case loading the auto/foo.el signals an error.
Good idea, but for now I'm not able to implement it :-)
I tried to put
  (run-hooks 'TeX-auto-cleanup-hook)
in `tex.el' inside a `condition-case' (you suggested to use this
function), but it didn't work.  I don't know where to catch the error.
 I have to study the code better.

>> If they are OK, can my changes without `TeX-auto-store-pre-string' be
>> committed?  I'm sending the last patch for `siunitx.el' without those
>> lines.
>
> Yes, I did so.  I made a small change in that LaTeX-siunitx-regexp is
> just the regex now [not a list (regex 1 LaTeX-auto-siunitx-unit)].  The
> latter is created at the call to `TeX-auto-add-regexp' in the lambda
> being the style hook for siunitx.
Thanks!

> And I have one more question: The new type for the parser is for siunitx
> units.  However, LaTeX-siunitx-regexp says it matches unit, power,
> prefix, and qualifier definitions.  Is that all the same, e.g., may I
> provide a qualifier where a power was expected?  Or should there be a
> individual parser type for each siunitx thingy?
I want to provide completion in minibuffer for all macros that can be
used in the mandatory argument to `\si' and the second mandatory
argument to `\SI'.  I called the type `unit' because they are almost
all units or their abbreviations.  Powers, prefixes and qualifiers are
usually a minority, but in my opinion they can be regarded all as the
same thing.  I don't believe a different parser for each of these
macros would be somehow more useful.

Bye,
Mosè Giordano



reply via email to

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