branch: main
commit 4dc9c8cc1d3672479665923bd0ae807839d3a64c
Author: Arash Esbati <[email protected]>
Commit: Arash Esbati <[email protected]>

    Improve matching of header end/trailer start in ConTeXt
    
    * context.el (ConTeXt-header-end): Add other macro names marking
    the header end.  Add regexp to match additional arguments.
    (ConTeXt-trailer-start): Add other macro names marking the trailer
    start.  Issue reported by Jim Diamond <[email protected]>:
    https://lists.gnu.org/archive/html/auctex/2026-03/msg00010.html
---
 context.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/context.el b/context.el
index 64f1179a..a154bbcc 100644
--- a/context.el
+++ b/context.el
@@ -1,6 +1,6 @@
 ;;; context.el --- Support for ConTeXt documents.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2025  Free Software Foundation, Inc.
+;; Copyright (C) 2003-2026  Free Software Foundation, Inc.
 
 ;; Author: Patrick Gundlach <[email protected]>
 ;;         Berend de Boer <[email protected]>
@@ -1257,14 +1257,18 @@ 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"))
+   ;; Allow one level of argument inside braces
+   "\\(?:[ \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."

Reply via email to