auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] A question with regexps


From: Arash Esbati
Subject: [AUCTeX-devel] A question with regexps
Date: Sat, 26 Sep 2015 16:19:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5

Hi all,

I have a question reg. building a regexp: I have a `newfloat.el' ready
where I have:

--8<---------------cut here---------------start------------->8---
(defvar LaTeX-newfloat-DeclareFloatingEnvironment-regex
  `(,(concat "\\\\DeclareFloatingEnvironment"
             "[ \t\n\r%]*"
             "\\["
             "[ \t\n\r%{}a-zA-Z0-9=,]*"
             "\\]"
             "[ \t\n\r%]*"
             "{\\([^}]+\\)}"
             "[ %]*{\\([^}]*\\)}")
    (1 2) LaTeX-auto-newfloat-DeclareFloatingEnvironment)
  "Matches the argument of `\\DeclareFloatingEnvironment' from
`newfloat.sty'.")
--8<---------------cut here---------------end--------------->8---

The idea is to pass the type of new float-env to AUCTeX and process it,
e.g.:

--8<---------------cut here---------------start------------->8---
\usepackage{newfloat}

\DeclareFloatingEnvironment[
  name=Code,
  listname={List of Codes},
  fileext=lol]{code}  %  {verbatim}
--8<---------------cut here---------------end--------------->8---

Currently, the definition above needs a mandatory `{'.  The downside is
that if a user omits the opening brace, the regexp fails and it parses
garbage until the next brace.

I played around and tried to limit it with `$' or `{?' etc., but could
not come up with something sensible.  Has anybody an idea how solve
this?

I'm attaching the style in case somebody wants to have a look.

TIA.  Best, Arash

Attachment: newfloat.el
Description: application/emacs-lisp


reply via email to

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