[Top][All Lists]

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

Re: [AUCTeX-devel] RFC: Extending array.el to parse \newcolumntype

From: Mosè Giordano
Subject: Re: [AUCTeX-devel] RFC: Extending array.el to parse \newcolumntype
Date: Fri, 26 Jun 2015 12:20:56 +0200

Hi Arash,

2015-06-23 23:19 GMT+02:00 Arash Esbati <address@hidden>:
> Hi all,
> I have extended `array.el' and now it parses user defined column types
> and adds them to `LaTeX-array-column-letters'.  I would appreciate if
> somebody could give it a roll before I make a proper submission.

Thanks for the patch, but... well... it doesn't work if cl hasn't been
previously loaded (at least in GNU Emacs with cl-* named functions).
We could alias `delete-duplicates' to `cl-delete-duplicates' if the
former is void and the latter is bound, but I'm not sure this is the
best option.  We've always striven to avoid loading `cl' at runtime, I
don't think this case is worth of breaking this rule.

If there is no chance to use `delete-duplicates', another possibility
is the following:

--8<---------------cut here---------------start------------->8---
(mapconcat 'identity
       (TeX-delete-duplicate-strings (split-string LETTERS "")) "")
--8<---------------cut here---------------end--------------->8---

but I haven't tested the performance of this solution.

I would update `LaTeX-array-column-letters' only if
`(LaTeX-array-column-letters)' non-nil:

--8<---------------cut here---------------start------------->8---
(defun LaTeX-array-auto-cleanup ()
  "Move parsed colors from `LaTeX-auto-array-newcolumntype' to
  (let ((newletters (LaTeX-array-newcolumntype-list)))
    (when newletters
      (set (make-local-variable 'LaTeX-array-column-letters)
        (concat "clrpmb"
            (mapconcat 'car newletters "")))))))
--8<---------------cut here---------------end--------------->8---

This avoid useless operations most of the times.

In the body of the lambda of `newcolumntype' argument, I think you can
replace the whole `set' with `(LaTeX-array-auto-cleanup)'.


reply via email to

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