auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Full file names in style system


From: David Kastrup
Subject: Re: [AUCTeX-devel] Full file names in style system
Date: Tue, 03 Jan 2006 20:27:26 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ralf Angeli <address@hidden> writes:

> Attached you can find a patch which changes the style system in a
> way that file names with extensions are used in case of
> \documentclass, \usepackage, \include and \input macros.  In
> addition options will not be put into `TeX-active-styles' on their
> own but rather encapsulated with the files they belong to.

Sorry I have not followed up on this yet, but I am in dreadful
deadline damage control right now, and haven't had the time to give
this proper justice.  However, I'll try at least to make some
comments.

> For the parser this means, if you have a file style-test.tex with the
> contents
>
> \documentclass[ngerman,a4paper,11pt]{scrartcl}
> \usepackage{graphicx}
> \begin{document}
> \input{foo}
> \end{document}
>
> you will get the following auto/style-test.tex.el:
>
> (TeX-add-style-hook "style-test.tex"
>  (lambda ()
>     (TeX-run-style-hooks
>      '("graphicx.sty" :type package :options nil)
>      "latex2e"
>      "scrartcl11"
>      '("scrartcl.cls" :type class :options ("11pt" "a4paper" "ngerman"))
>      '("foo.tex" :type file))))

Is the :type stuff actually necessary?  What it is used for?

> Until now we had only strings in `TeX-active-styles' which made it
> very easy to look for certain styles by means of regular expressions
> (e.g. in case of `LaTeX-command-style').  With the scheme above this
> will be more difficult because there will have to be a way to look
> for partially matching property lists.

We could just use several data structures, one for each property.  I
actually would prefer to use hash tables instead of lists: faster
access.  However, regular expression matching would not really be
feasible or at least efficient, then.  Could you remind me where we
actually make use of it?  Maybe it can be done without them.

> That means one should be able to say "do a certain action if option
> foo is given for style bar".  The interface for the user could
> probably allow for the specification of regular expressions for file
> names and properties.  For example if you wanted to match all
> KOMA-Script classes in connection with 11 or 12 point font size you
> could specify ("\\`scr.+\\.cls\\'" :options "\\`1[12]pt\\'") Usually
> one does not need complicated stuff like that but rather match a
> single option of a single file but I don't consider this overly
> user-friendly in any way.

Who is bothered about the users?  We are working with internal
interfaces here.  One _can_ even do such a match on hash tables.  But
I am not sure where this would really be required.

[...]

> I guess for starters I could check in the part of the patch which
> makes the style system use full file names and put aside handling of
> package options.  After all, this is a very LaTeX-centric solution
> until now and might have to get some thought with respect to the
> other AUCTeX modes.  And the switch to full file names alone will
> already introduce quite some incompatibilities compared to former
> versions of AUCTeX.

Which is why we should try to come up with a backward-compatible
scheme.

> Oh, by the way, for the patch to work you will have to rename
> style/graphicx.el to style/graphicx.sty.el and style/babel.el to
> style/babel.sty.el and change
>
> (TeX-add-style-hook
>  "<style>"
>
> to
>
> (TeX-add-style-hook
>  "<style>.sty"
>
> inside those files.

I think that exiting autogenerated and user-created style trees will
be common enough to make us want to support them.  So
*/graphicx.el should get used as fallback if */graphicx.sty.el can't
be found.

So we should use something like
(let ((load-suffixes
       (nconc
         (delq nil
           (mapcar (lambda(x) (unless (string= x "")
                                      (conc ".sty" x)))))
         load-suffixes)))
  (load "graphicx"))

to load the style file.

> graphicx and babel are the packages I used for testing.  For the
> transition all file-related style files will have to be renamed and
> changed, of course.

I'd like to avoid making this mandatory.  I think there are still
externally maintained AUCTeX style files around, and it would be nice
if they were not required to get renamed for basic functionality.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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