auctex-devel
[Top][All Lists]
Advanced

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

Re: Convenience functions with external deps (was: [SOLVED by Arash])


From: Arash Esbati
Subject: Re: Convenience functions with external deps (was: [SOLVED by Arash])
Date: Mon, 10 Jan 2022 13:05:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Sorry for top-posting, but may I ask to respond to this message since
the old subject line looks odd (and I forgot to change it in my previous
message.)  TIA.

Arash Esbati <arash@gnu.org> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:
>
>> I just found 
>> https://tex.stackexchange.com/questions/557959/emacs-auctex-tabular-vertical-alignment-of-cells
>>
>> That is very nice. Thanks Arash.
>
> Sure, welcome.
>
>> Why not including this function in AucTeX?
>
> FTR, this is a more polished version of the function:
>
> (defun LaTeX-align-tabular ()
>   (interactive)
>   (let ((env (LaTeX-current-environment)))
>     ;; Extra usage check that we don't mess the entire document:
>     (unless (string= env "document")
>       (let ((s (make-marker))
>             (e (make-marker)))
>         (set-marker s (save-excursion
>                         (LaTeX-find-matching-begin)
>                         (line-beginning-position 2)))
>         (set-marker e (save-excursion
>                         (LaTeX-find-matching-end)
>                         (line-end-position 0)))
>         ;; Check if the environment has an entry in
>         ;; `LaTeX-indent-environment-list' otherwise
>         ;; `LaTeX-fill-environment' will play hovoc
>         (when (assoc env LaTeX-indent-environment-list)
>           (LaTeX-fill-environment nil))
>         (whitespace-cleanup-region s e)
>         (align-regexp s e "\\(\\s-*\\)&" 1 1 t)
>         (align-regexp s e "\\(\\s-*\\)\\\\\\\\")
>         (set-marker s nil)
>         (set-marker e nil)))))
>
> AUCTeX has a policy not to rely on external package at run-time.  The
> function above relies on align.el; with the `whitespace-cleanup-region'
> part whitespace.el is also involved (That call can be removed, IMO).
>
> The function above might be handy, but it breaks the current policy.  If
> we don't include it, we could start documenting this sort of things in
> the manual.
>
> What do others think?
>
> Best, Arash



reply via email to

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