On 2013-01-02 13:27, Tassilo Horn wrote:
>> I have one more suggestion for `LaTeX-env-document': prevent
>> documentclass from being inserted, if there's already one present in the
>> file.  At least I find it somewhat annoying to be prompted for it.
> 
> That's a better idea than omitting the document environment as you've
> suggested in your other mail.

I would appreciate if someone could have a look at this patch.  Thank you.

I was asked to provide a ChangeLog entry:

2013-01-10  Mads Jensen  <[email protected]>

        * latex.el (LaTeX-env-document): Only insert \documentclass in
        case the document does not already contain one.
--
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark
+45 6168 8518
My brain is my second favorite organ.
      -- Woody Allen
767,770c767,782
<   (TeX-insert-macro "documentclass")
<   (LaTeX-newline)
<   (LaTeX-newline)
<   (LaTeX-newline)
---
>   ;; just assume a single valid \\documentclass, i.e., one not in a
>   ;; commented line
>   (let ((found nil))
>     (save-excursion
>       (while (and (not found)
>         (re-search-backward
>          "\\\\documentclass\\(\\[[a-z0-9A-Z\-\_,]*\\]\\)?\\({[^}]+}\\)"
>          nil t))
>         (and (not (TeX-in-commented-line))
>              (setq found t))))
>     (if (not found)
>         (progn
>           (TeX-insert-macro "documentclass")
>           (LaTeX-newline)
>           (LaTeX-newline)
>           (LaTeX-newline))))

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to