[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] [PATCH 1/3] Parse env's defined with `\lstnewenvironm
From: |
Arash Esbati |
Subject: |
Re: [AUCTeX-devel] [PATCH 1/3] Parse env's defined with `\lstnewenvironment'. |
Date: |
Mon, 01 Jun 2015 21:37:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 |
Tassilo Horn <address@hidden> writes:
> So indeed, if the \newenvironment has a second bracket-argument, and
> thus the first argument is optional, no arguments are considered at all.
>
> I've just fixed that in git. Now
>
> \newenvironment{colorenv}[2][red]{\color{#1}#2}{}
>
> results in ("colorenv" 1) being in (LaTeX-environment-list), i.e., it
> now carries the number of arguments minus the optional one.
Thanks for your response. I saw your patch in git and may I suggest to
extend it to:
--8<---------------cut here---------------start------------->8---
;; Ditto for environments with optional args
(mapc (lambda (entry)
(add-to-list 'LaTeX-auto-environment
(list (nth 0 entry) 'LaTeX-env-args (vector "argument")
(1- (string-to-number (nth 1 entry))))))
LaTeX-auto-env-args-with-opt)
--8<---------------cut here---------------end--------------->8---
The definition above then results in
("colorenv" LaTeX-env-args ["argument"] 1)
in (LaTeX-environment-list) and AUCTeX asks for the optional argument
while inserting the environment.
Best, Arash