[Top][All Lists]

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

[AUCTeX-devel] Make TeX-insert-macro behave intelligently on \usepackage

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

Spending some hours on the train Saturday returning from the general
annual meeting of the Danish TeX user Groups I ended up scratching an
itch I've had for years.

Today when we run TeX-insert-macro (C-c C-m) for \usepackage we are
first asked what options we want to give the package and then asked
what package we want. As a bonus the AUCTeX style file (if one exists)
for the package is loaded.

What I think we should have is first to be asked what package we are
interested in. Then the AUCTeX style file is loaded (if it exists)
because then it can load hints for asking us about the package

The attached patch provide this by, after asking for the package and
loading a style file, checking if the symbol (for package foobar)
LaTeX-foobar-options is bound.

It should either be bound to a list in which case the elements in the
list should be strings that can be considered as options or it should
be bound to function which is then supposed to ask for options and/or
do whatever intelligent behavior you can imagine.

If the symbol is not bound to a list or a function we are just asked
about what package options we want as we are used to (although still
in the opposite order of course).

As tests the patch holds a modification to the babel AUCTeX-style
where it defalias'ses LaTeX-babel-options to the list of supported

And then I've implemented style files for inputenc.sty and dk-bib.sty.

The AUCTeX style file for inputenc.sty has a function
LaTeX-inputenc-options that based on the wanted input encoding can put
the buffer into the corresponding Emacs coding system. You need
latexenc.el (shamelessly by me) from Emacs 22 otherwise you will just
get plain old unintelligent behavior.

For dk-bib.sty (shamelessly by me) the style file does some checking
of one of the keyval values via a LaTeX-dk-bib-options function.

I guess there is dozens of ways to implement the general idea behind
this and I guess there will be even more ways to build this into the
package style files (and opinions about what to ask, do and don't).

So please feel free to comment on this!

Kind regards,
Arne Jørgensen <>
DK-TUG / Dansk TeX-brugergruppe <>

reply via email to

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