Hi Jim, Jim Diamond <[email protected]> writes:
> A patch to fix this particular bug is attached. I do have a longish > comment as part of the patch, which some future developer might find > useful. > > The indentation for ConTeXt still has some issues, but with this patch > there is one less. Thanks for the patch. I have some minor comments, see below. > From bb2eee7fa71539b368b461dee8823c923d7a9903 Mon Sep 17 00:00:00 2001 > From: Jim Diamond <[email protected]> > Date: Wed, 25 Feb 2026 18:31:46 -0400 > Subject: [PATCH] Fix indentation for ConTeXt macros with arguments > > * context.el (ConteXt-find-indent): add a specific case to ^ Add > handle macro definitions with arguments where the open brace > is on the next line, otherwise the indentation is wildly > incorrect. (Bug#80454) > --- > context.el | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/context.el b/context.el > index 25cbeb34..9872bb51 100644 > --- a/context.el > +++ b/context.el > @@ -1412,6 +1412,25 @@ else. There might be text before point." > (ConTeXt-environment-start-name) > ConTeXt-text)))) ; other environments? > (+ indent (current-column) ConTeXt-indent-basic)) > + ;; This code correctly indents the initial brace of a macro with > + ;; arguments when the brace is on the following line. > + ;; JD note: It is unclear to me what the code in the 't' case below > + ;; is trying to accomplish; modifying it to not incorrectly indent > + ;; an open brace following the \def line of a macro with argument(s) > + ;; seems likely to break something else (also for \define). > + ;; Therefore handle \def and \define with this specific case. > + ;; Note that \def might be preceded by various combinations of > + ;; the following modifiers (LMTX): > + ((or (looking-at > + (concat "\\(?:" > + (regexp-opt '("\\enforced" "\\expandafter" "\\frozen" > + "\\global" "\\instance" "\\immutable" > + "\\mutable" "\\noaligned" "\\noexpand" > + "\\overloaded" "\\permanent" > "\\protected" > + "\\tolerant" "\\untraced")) > + "*\\)\\\\def\\\\")) In case you don't need the match later, you can consider using `looking-at-p'. And what do you think about: (concat "\\(?:\\\\" (regexp-opt '("enforced" "expandafter" "frozen" "global" "instance" "immutable" "mutable" "noaligned" "noexpand" "overloaded" "permanent" "protected" "tolerant" "untraced")) "\\)*\\\\def\\\\") > + (looking-at "\\\\define[[\\\\]")) (looking-at-p "\\\\define[[\\]")) should work; you don't need \\\\ inside the char alternative for a single backslash. Best, Arash _______________________________________________ bug-auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-auctex
