auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Insertion of braces when the last argument of a macro


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Insertion of braces when the last argument of a macro is optional
Date: Mon, 30 Sep 2013 12:40:34 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Mosè Giordano <address@hidden> writes:

Hi Mosè,

> You're right, I agree.  The attached patch takes a completely
> different approach: it makes it possible to override the value of
> `TeX-insert-braces'.  `TeX-insert-braces' is forced to nil for
> {top,mid,bottom}rule macros.  A FIXME in style/booktabs.el is also
> resolved.

I don't like the setq-ing and resetting of `TeX-insert-braces'.  It's
not unlikely that a user aborts (C-g) while inserting a macro, and then
the resetting is skipped.  You could ensure resetting by wrapping
anything else in a `ignore-errors` form, but even then things could go
wrong in case a user aborts before the original value has been saved.

I don't know, but maybe it would be better to have an explicit,
buffer-local alist (TeX-insert-braces-alist?) of macros that either
require braces or must not have braces.  Example:

  '(("toprule" . nil)  ;; there must not be {}
    ("foobar"  . t))   ;; there must be {}

Then `TeX-parse-macro' could check this alist first before using the
standard heuristics.

> As a side note, I don't like very much the `last-optional-rejected'
> feature, because there are cases in which the second optional argument
> shouldn't be skipped if the previous one has been rejected.

Hm, well, yes.  On the other hand, I also think that it's valuable that
you can easily stop auctex from querying all remaining optional
arguments.

Maybe a good idea was to add another possible value
`show-all-optional-args' to `TeX-insert-macro-default-style' which would
always query for all optional args, regardless the value of
`last-optional-rejected'.  (BTW: That it won't query for further
optional args after rejecting one with `show-optional-args' isn't
properly documented, so that would be a good chance to do that.)

Bye,
Tassilo



reply via email to

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