[Top][All Lists]

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

[AUCTeX-devel] Re: Make TeX-insert-macro behave intelligently on \usepac

From: Arne Jørgensen
Subject: [AUCTeX-devel] Re: Make TeX-insert-macro behave intelligently on \usepackage
Date: Mon, 10 Oct 2005 17:56:17 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> I should add the information that Arne has started the copyright
> assignment process, and it is not the first project for which he has
> done this.

I received, signed and mailed back the papers today.

> So his patches can be applied.  Did anybody look at them yet?

Apparently not.

> I think this sounds like something useful to have.

So do I, but that's probably no surprise.

Let me add some thoughts and comments about this.

First of all it would be nice if we could agree whether the general
idea is good or not. That is do we want to be asked "intelligent"
questions when we insert a \usepackage command?

I'm pretty sure we can agree on that (since nobody complained yet) and
otherwise we could add a variable to disable it.

The next thing is how to implement it (is there a better way than what
I did). Let me just revive in a few words what my implementation does:

When doing a `TeX-insert-macro' (C-c C-m) with \usepackage it reverts
the order in which questions are asked (now it first asks for
options, then for the package name). The reverted order is used for
loading the AUCTeX style file (if present) for the package and in the
AUCTeX style file what options to ask for.

The definition of options can be either a list of option names and
thereby letting the user do completions on them. Or the definition can
be a function handling everything about options -- this makes it
possible to have arbitrarily complex and intelligent behavior (asking
stupid questions, validating input, ....).

I have been thinking about more flexibel, beautiful and powerful ways
to do this. Could we use alist's for storing keyval options and their
values? and stuff like that. but none of them seems to be more
flexible, beautiful or powerful. Actually I think my implementation is
a fair compromise between simplicity (an option list) and power (a
function) and that everything in between is not worth the trouble. But
feel free to prove me wrong.

An extension of the functionality would be to have the
`TeX-auto-generate'[1] stuff scan for \DeclareOption and put those
options into a list in the auto generated style file. This won't cover
all cases but it is most likely the best we can do in an automatic

Since there hasn't been any comments so far I think it would be a good
idea to just add my patches now (unless there is a release nearby) and
then comments can (will?) show along the way. I suspect most comments
will be regarding the amount and shape of questions asked about
options. And that can be easily adjusted as we move on and so can
adaption of more AUCTeX style files. I am willing to work more on
this, but much work cannot be expected for me in the next couple of
months (I'm working my final project and finishing my education).

That was quite some text ... feel free to speak out loud. 

Kind regards,


[1] There is a bug (maybe someones password?) in the definition of
`LaTeX-auto-regexp-list' Here is a patch:

Index: latex.el
RCS file: /cvsroot/auctex/auctex/latex.el,v
retrieving revision 5.385
diff -u -p -r5.385 latex.el
--- latex.el    6 Oct 2005 20:36:17 -0000       5.385
+++ latex.el    10 Oct 2005 15:46:43 -0000
@@ -1178,7 +1178,6 @@ This is necessary since index entries ma
        (,(concat "\\\\newtheorem{\\(" token "+\\)}") 1 LaTeX-auto-environment)
        1 TeX-auto-file)
1 TeX-auto-file)
        (, (concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 

Arne Jørgensen <>

reply via email to

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