auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Indentation of \if statements


From: Tassilo Horn
Subject: Re: [AUCTeX] Indentation of \if statements
Date: Fri, 19 Dec 2014 09:16:36 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Oleh <address@hidden> writes:

Hi Oleh,

> I've added the generalization to anything that starts with "\if".
> Should be fine unless people use something like:
>
>     \newcommand\iffy{...}
>
> See the attached patch.

No, that's too lax.  In one of my documents I actually do have an \iface
macro which has nothing to with "if".

What I basically had in mind was having two variables
`TeX-begin-macro-list' and `TeX-end-macro-list'.  From those begin/end
regexes could be created using `regexp-opt' and used analogously to
`LaTeX-begin-regexp'/`LaTeX-end-regexp'.

This has the benefit that a hypothetical ifplatform.el style simply can
add \ifwindows and friends to the `TeX-begin-macro-list' and indentation
should just work.

By default, `TeX-begin-macro-list' should contain all the standard TeX
if variations: if, ifx, ifnum, ifodd, ifdim, iftrue, iffalse, ....  Then
the begin regex would be computed by (concat "\\\\" (regexp-opt
TeX-begin-macro-list) "\\b").  Note that "\\\\if\\b" also matches
"address@hidden" solving your original issue.

Likewise, `TeX-end-macro-list' would contain "else" and "fi".

Does that make sense?

Bye,
Tassilo




reply via email to

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