Jim <[email protected]> writes:

> And there is one more nasty problem, which my .* would not have taken care
> of.  When the argument is the   [...]   version, it can extend over
> multiple lines.  So someone could say (for example)
>         \startdocument[title={Blah blah},
>                 before=<something>,
>                 after=<someOtherThing>]
> So it may need something a bit more complex to skip a   [...]  argument.
>
> Having said that, a solution that works in most cases is nicer than no
> solution at all.

As Jamie Zawinski once said:

  Some people, when confronted with a problem, think “I know, I'll use
  regular expressions.”  Now they have two problems.

How about this:

--8<---------------cut here---------------start------------->8---
diff --git a/context.el b/context.el
index 64f1179a..9a396e25 100644
--- a/context.el
+++ b/context.el
@@ -1257,14 +1257,17 @@ header is at the start of a line."
   (concat
    (regexp-quote TeX-esc)
    (ConTeXt-environment-start-name)
-   ConTeXt-text))
+   (regexp-opt `( ,ConTeXt-text "component" "document" "MPpage"
+                  "product" "TEXpage"))
+   "\\(?:[ \t]*\\[[^]]+\\]\\|.*$\\)"))

 (defun ConTeXt-trailer-start ()
   "Default start of trailer marker for ConTeXt documents."
   (concat
    (regexp-quote TeX-esc)
    (ConTeXt-environment-stop-name)
-   ConTeXt-text))
+   (regexp-opt `( ,ConTeXt-text "component" "document" "MPpage"
+                  "product" "TEXpage"))))

 (defun ConTeXt-outline-offset ()
   "Offset to add to `ConTeXt-section-list' levels to get outline level."
--8<---------------cut here---------------end--------------->8---

Best, Arash

Reply via email to