[Top][All Lists]

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

Re: [AUCTeX] [PATCH] Add indentation for tabular environment

From: Tassilo Horn
Subject: Re: [AUCTeX] [PATCH] Add indentation for tabular environment
Date: Fri, 11 Oct 2013 15:45:46 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Oleh <address@hidden> writes:

Hi again,

> That one doesn't work either, since I'm calling it on a string, which
> is a vector and not a list.

Ah, yes, I've overlooked that.

> I just side-stepped the issue by calling `how-may' instead.

Won't work either.  On XEmacs, `how-many' only has one argument REGEXP,
so you can't restrict it to a region.  :-(

So it seems you have to use `re-search-forward' with BOUND parameter in
a loop and count the number of matches yourself.  By the way: "&" as a
regexp is too lax.  It also matches tho ampersand in "bla \& bla" which
is not a column separator.  The regexp "[^\\]&" should do the trick.

> Here's an updated patch.

Using the :set property of defcustom is a good idea, and it also saves
the tabular-like environments variable.

One nitpick:

+(defvar LaTeX-tabularlike--end nil
+  "A regular expression that matches the ending of environments
+that will be aligned with `LaTeX-indent-tabular'.
+Do not set this variable. This variable is auto-set
+by customizing `LaTeX-indent-environment-list'.")

The first sentence of a docstring should fit into one line.  I'd go with

  "A regexp matching tabular-like environment ends.
Those will be aligned with `LaTeX-indent-tabular'.

Also, I'd put a hyphen between "tabular" and "like" in the variable
name.  And why the double-hyphen?  To show that it's kind of private and
not intended to be modifier by users?  In that case, I think the
convention is to use the double-hyphen immediately after the
"namespace", that is, `LaTeX--tabular-like-end'.

We don't follow that convention in AUCTeX currently (because AUCTeX is
much older than that convention), but I wouldn't object to start using

> It uses `cl-reduce', which is probably not what you want.

You name it. ;-)

> What's the compatible replacement for `cl-reduce'?

A while loop pushing into a local variable, or `mapc' where the lambda
pushes into a local variable.


reply via email to

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