Hi Arash,

2015-06-23 23:19 GMT+02:00 Arash Esbati <esb...@gmx.de>:
> 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
`LaTeX-array-column-letters'."
  (let ((newletters (LaTeX-array-newcolumntype-list)))
    (when newletters
      (set (make-local-variable 'LaTeX-array-column-letters)
       (delete-duplicates
        (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)'.

Bye,
Mosè

_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to