bug#80350: [PATCH] Re: bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-03-19 Thread Arash Esbati
Hi Jim,

Jim  writes:

> Damn!  I thought I got them all.  I see two of them are trailing
> blank(s) that are in parts of context error messages.  But I don't
> think those are significant for the parsing.  I probably should have
> signified them in some more visual way.  If I discover they are at all
> important I'll put them back in with something like  the next
> time I touch something.

Yes, please do so, we don't like trailing spaces ;-)

> Huh.  I forgot about the fact that this patch was possibly NEWSworthy.
>
> Yes, what you wrote for NEWS is good.

No worries, and thanks for your response, I installed that change.

> Certainly the whole indentation thing needs some work.  I have been
> busy the last few days updating the "A not so short intro to ConTeXt"
> book, and there are places where even indenting stuff that is mostly
> text occasionally causes issues.  When I need a break from that maybe
> I'll try to see if the LaTeX indentation code can work with ConTeXt
> (with hopefully not too much persuasion).
>
> And all the other things that could be added... :-)

Great, thanks, looking forward to your contribution.  For now, I'm
closing this report.

Best, Arash



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: [PATCH] Re: bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-03-16 Thread Arash Esbati
Hi Jim,

Jim Diamond  writes:

> An improved patch so that AUCTeX properly parses ConTeXt LMTX error
> messages.
>
> Aside from the required lisp code, I took the liberty of adding some
> comments in relevant places to assist the next person who might try to
> modify this code.

Many thanks for the new patch.  I went through it, deleted some trailing
spaces reported by Git, slightly touched the log message and installed
it.

I'd say the only thing missing is one or two entries in NEWS.org.  WDYT
about this:

--8<---cut here---start->8---
diff --git a/NEWS.org b/NEWS.org
index 506b3fc9..cd9f3f51 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -25,6 +25,11 @@
 (luatex "LuaTeX" "luatex" "lualatex --jobname=%(s-filename-only)" "luatex")
   #+end_src

+** Fixed
+
+- Fix parsing of error messages for ConTeXt LMTX.
+- Fix indentation for macros with arguments in ConTeXt mode.
+
 * [14.1.2] - 2026-01-14

 ** Fixed
--8<---cut here---end--->8---

Again, many thanks for your contribution; looking forward to more to
come.

Best, Arash



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: [PATCH] Re: bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-03-10 Thread Jim Diamond
An improved patch so that AUCTeX properly parses ConTeXt LMTX error
messages.

Aside from the required lisp code, I took the liberty of adding some
comments in relevant places to assist the next person who might try to
modify this code.

Jim
>From 97790acadfc4e6c0fc29280c8e63d49e9398aaba Mon Sep 17 00:00:00 2001
From: Jim Diamond 
Date: Tue, 10 Mar 2026 14:04:10 -0300
Subject: [PATCH] Fix parsing of error messages for ConTeXt LMTX

* tex.el (TeX-parse-error): change the big regexp so that it also
matches ConTeXt LMTX error messages.  Add code to the processing
of the matches of this regexp to handle the ConTeXt case.
(TeX-error): add a condition and tweak a regexp to match the way
ConTeXt LMTX reports errors.  Add some new comments to assist
future maintainers and fix some other comments.
(TeX-find-display-help): add a comment for future maintainers.
(TeX-help-error): add a section of code to find the given error
in the ConTeXt output.  (Bug#80350)
* context.el (TeX-ConTeXt-sentinel-check): the output of ConTeXt
LMTX is very different than that of pdftex et al; consequently,
modifying `TeX-sentinel-check' to understand LMTX output might
lead to an unmaintainable mess.  Instead, create a new function.
(TeX-ConTeXt-sentinel): rewrite to reflect ConTeXt LMTX error
messages and to use `TeX-ConTeXt-sentinel-check' instead of
`TeX-TeX-sentinel-check'.  Remove deprecated Mark II code.
(Bug#80350)
---
 context.el | 124 +
 tex.el | 122 
 2 files changed, 181 insertions(+), 65 deletions(-)

diff --git a/context.el b/context.el
index 84b3efef..64f1179a 100644
--- a/context.el
+++ b/context.el
@@ -567,45 +567,93 @@ for a label to be inserted after the sectioning command."
 
 
 ;; Various
+
+;; This function is called with (current-buffer) = the output buffer.
+(defun TeX-ConTeXt-sentinel-check (process name)
+  "Check ConTeXt (LMTX) output buffer after running TeX.
+Return t if errors were found."
+  ;; Set TeX-current-page to (effectively) match what
+  ;; TeX-TeX-sentinel-check does:
+  ;; -> if no errors, the number of pages shipped out; and
+  ;; -> if errors, the number of pages shipped out + 1.
+  ;; Also determine the extension of the output file.
+  (save-excursion
+(goto-char (point-max))
+(if (re-search-backward " > flushing realpage \\([0-9]+\\), " nil t)
+(setq TeX-current-page (TeX-match-buffer 1))
+  (setq TeX-current-page "0"))
+;; If running in "don't quit on error" mode, there will be a
+;; '^pages .* > flushing realpage' message after the '^tex error'
+;; message.  In this case, no need to add 1.
+(goto-char (point-min))
+(if (re-search-forward "^tex error" nil t)
+(if (re-search-forward "^pages .* > flushing realpage" nil t)
+nil
+  (setq TeX-current-page (number-to-string
+  (1+ (string-to-number TeX-current-page))
+(setq TeX-current-page (concat "{" TeX-current-page "}"))
+(setq TeX-output-extension "pdf"))   ;; for the last 200 years now, +/-.
+
+  (if process (TeX-format-mode-line process))
+
+  (if (catch 'found
+(while (re-search-forward
+"^\\(?:.*tex error on line [0-9]+ in file \\(.+?\\):\\)" nil t)
+  (if (or (not (match-beginning 1))
+  ;; Ignore non-error warning. (bug#55065)
+  (file-exists-p (TeX-match-buffer 1)))
+  (throw 'found t
+  (progn
+(if TeX-error-overview-open-after-TeX-run
+;; Don't leave inconsistent message.
+(message nil)
+  (message "%s errors in `%s'. Use %s to display."
+   name (buffer-name)
+   (substitute-command-keys
+"[TeX-next-error]")))
+(setq TeX-command-next TeX-command-default)
+;; error reported to TeX-error-report-switches
+(setq TeX-error-report-switches
+  (plist-put TeX-error-report-switches
+ (intern (plist-get TeX-error-report-switches
+'TeX-current-master))
+ t))
+t)
+;; In case that there were only non-error warnings of type
+;; bug#55065, restore point to the initial position.
+(goto-char (point-min))
+(setq TeX-command-next TeX-command-Show)
+nil))
+
+
 (defun TeX-ConTeXt-sentinel (process name)
-  "Cleanup TeX output buffer after running ConTeXt."
-  (cond
-   ;; Mark IV
-   ((with-current-buffer TeX-command-buffer
-  (string= ConTeXt-Mark-version "IV"))
-(cond ((TeX-TeX-sentinel-check process name))
-  ((re-search-forward "fatal error: " nil t)
-   (message (concat name ": problems after "
-(TeX-current-pages)))
-   (setq TeX-command-next TeX-command-default))
-  (t
-   (message (concat name ": successf

bug#80350: [PATCH] Re: bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work:

2026-03-09 Thread Arash Esbati
Hi Jim,

Jim Diamond  writes:

> A patch so that AUCTeX properly parses ConTeXt LMTX error messages.
>
> Aside from the required lisp code, I took the liberty of adding some
> comments in relevant places to assist the next person who might try to
> modify this code.

Many thanks for working on this.  Please find my comments below.

> From 7877108bde8e1655678d4ba5ac13c39d806ffb3d Mon Sep 17 00:00:00 2001
> From: Jim Diamond 
> Date: Mon, 2 Mar 2026 18:33:46 -0400
> Subject: [PATCH] Fix parsing of error messages for ConTeXt LMTX.
>
> * tex.el (TeX-parse-error, TeX-fin-display-help, TeX-error)
^
TeX-fin*d*-...?

> TeX-help-error): many changes to these functions to handle error
> messages output by ConTeXt LMTX.

Can you be more specific about the changes?  We usually describe briefly
those changes.

> Some illuminating comments added for the next person who touches this
> code.  (Bug#80350) * context.el (TeX-ConTeXt-sentinel): rewrite to
> reflect ConTeXt LMTX error messages and to use
> `TeX-ConTeXt-sentinel-check' instead of `TeX-TeX-sentinel-check'.  Add
> function `TeX-ConTeXt-sentinel-check' rather than adapting
> `TeX-TeX-sentinel-check' since the ConTeXt LMTX error message syntax
> is so different from that of pdftex et al.  (Bug#80350) --- context.el
> | 125 + tex.el |
> 121 --- 2 files
> changed, 182 insertions(+), 64 deletions(-)
>
> diff --git a/context.el b/context.el
> index 84b3efef..3f78d4a8 100644
> --- a/context.el
> +++ b/context.el
> @@ -567,45 +567,94 @@ for a label to be inserted after the sectioning 
> command."
>  
>  
>  ;; Various
> +
> +;; This function is called with (current-buffer) = the output buffer.
> +(defun TeX-ConTeXt-sentinel-check (process name)
> +  "Check ConTeXt (LMTX) output buffer after running TeX.
> +  Return  t  if errors were found."
^   ^ ^

Do you have an extra space at the beginning of the second line of the
docstring?  If so, please remove it.  Are the extra spaces around t on
purpose?

> +  ;; Set TeX-current-page to (effectively) match what
> +  ;; TeX-TeX-sentinel-check does:
> +  ;; -> if no errors, the number of pages shipped out; and
> +  ;; -> if errors, the number of pages shipped out + 1.
> +  ;; Also determine the extension of the output file.
> +  (save-excursion
> +(goto-char (point-max))
> +(if (re-search-backward " > flushing realpage \\([0-9]+\\), " nil t)
> + (setq TeX-current-page (TeX-match-buffer 1))

I think you have Tabs in your change, e.g., in the line above.  AUCTeX
repo has this in its .dir-locals.el:

  (emacs-lisp-mode . ((mode . bug-reference-prog)
  (electric-quote-comment . nil)
  (electric-quote-string . nil)
  (indent-tabs-mode . nil)))

I wonder where those Tabs are coming?

> +  (setq TeX-current-page "0"))
> +;; If running in "don't quit on error" mode, there will be a
> +;; '^pages .* > flushing realpage' message after the '^tex error'
> +;; message.  In this case, no need to add 1.
> +(goto-char (point-min))
> +(if (re-search-forward "^tex error" nil t)
> + (if (re-search-forward "^pages .* > flushing realpage" nil t)
> + nil
> +   (setq TeX-current-page (number-to-string
> +   (+ 1 (string-to-number TeX-current-page))

  (1+ (string-to-number TeX-current-page))

> +(setq TeX-current-page (concat "{" TeX-current-page "}"))
> +(setq TeX-output-extension "pdf"))   ;; for the last 200 years now, +/-.
> +
> +  (if process (TeX-format-mode-line process))
> +
> +  (if (catch 'found
> +(while (re-search-forward
> + "^\\(?:.*tex error on line [0-9]+ in file \\(.+?\\):\\)" nil t)
> +  (if (or (not (match-beginning 1))
> +  ;; Ignore non-error warning. (bug#55065)
> +  (file-exists-p (TeX-match-buffer 1)))
> +  (throw 'found t
> +  (progn
> +(if TeX-error-overview-open-after-TeX-run
> + ;; Don't leave inconsistent message.
> + (message nil)
> +   (message "%s errors in `%s'. Use %s to display."
> +name (buffer-name)
> +(substitute-command-keys
> + "[TeX-next-error]"))
> +   )

No sole parenthesis in a line, please.

> +(setq TeX-command-next TeX-command-default)
> +;; error reported to TeX-error-report-switches
> +(setq TeX-error-report-switches
> +  (plist-put TeX-error-report-switches
> + (intern (plist-get TeX-error-report-switches
> +'TeX-current-master))
> + t))
> +t)
> +;; In case that there were only non-error warnings of type
> +;; bug#55065, restore point to the initial position.
> +(goto-char (point-min))
> +(setq TeX-comm

bug#80350: [PATCH] Re: bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work:

2026-03-02 Thread Jim Diamond
A patch so that AUCTeX properly parses ConTeXt LMTX error messages.

Aside from the required lisp code, I took the liberty of adding some
comments in relevant places to assist the next person who might try to
modify this code.

Jim
>From 7877108bde8e1655678d4ba5ac13c39d806ffb3d Mon Sep 17 00:00:00 2001
From: Jim Diamond 
Date: Mon, 2 Mar 2026 18:33:46 -0400
Subject: [PATCH] Fix parsing of error messages for ConTeXt LMTX.

* tex.el (TeX-parse-error, TeX-fin-display-help, TeX-error)
TeX-help-error): many changes to these functions to handle error
messages output by ConTeXt LMTX.  Some illuminating comments added
for the next person who touches this code.  (Bug#80350)
* context.el (TeX-ConTeXt-sentinel): rewrite to reflect ConTeXt
LMTX error messages and to use `TeX-ConTeXt-sentinel-check'
instead of `TeX-TeX-sentinel-check'.  Add function
`TeX-ConTeXt-sentinel-check' rather than adapting
`TeX-TeX-sentinel-check' since the ConTeXt LMTX error message
syntax is so different from that of pdftex et al.  (Bug#80350)
---
 context.el | 125 +
 tex.el | 121 ---
 2 files changed, 182 insertions(+), 64 deletions(-)

diff --git a/context.el b/context.el
index 84b3efef..3f78d4a8 100644
--- a/context.el
+++ b/context.el
@@ -567,45 +567,94 @@ for a label to be inserted after the sectioning command."
 
 
 ;; Various
+
+;; This function is called with (current-buffer) = the output buffer.
+(defun TeX-ConTeXt-sentinel-check (process name)
+  "Check ConTeXt (LMTX) output buffer after running TeX.
+  Return  t  if errors were found."
+  ;; Set TeX-current-page to (effectively) match what
+  ;; TeX-TeX-sentinel-check does:
+  ;; -> if no errors, the number of pages shipped out; and
+  ;; -> if errors, the number of pages shipped out + 1.
+  ;; Also determine the extension of the output file.
+  (save-excursion
+(goto-char (point-max))
+(if (re-search-backward " > flushing realpage \\([0-9]+\\), " nil t)
+   (setq TeX-current-page (TeX-match-buffer 1))
+  (setq TeX-current-page "0"))
+;; If running in "don't quit on error" mode, there will be a
+;; '^pages .* > flushing realpage' message after the '^tex error'
+;; message.  In this case, no need to add 1.
+(goto-char (point-min))
+(if (re-search-forward "^tex error" nil t)
+   (if (re-search-forward "^pages .* > flushing realpage" nil t)
+   nil
+ (setq TeX-current-page (number-to-string
+ (+ 1 (string-to-number TeX-current-page))
+(setq TeX-current-page (concat "{" TeX-current-page "}"))
+(setq TeX-output-extension "pdf"))   ;; for the last 200 years now, +/-.
+
+  (if process (TeX-format-mode-line process))
+
+  (if (catch 'found
+(while (re-search-forward
+   "^\\(?:.*tex error on line [0-9]+ in file \\(.+?\\):\\)" nil t)
+  (if (or (not (match-beginning 1))
+  ;; Ignore non-error warning. (bug#55065)
+  (file-exists-p (TeX-match-buffer 1)))
+  (throw 'found t
+  (progn
+(if TeX-error-overview-open-after-TeX-run
+   ;; Don't leave inconsistent message.
+   (message nil)
+ (message "%s errors in `%s'. Use %s to display."
+  name (buffer-name)
+  (substitute-command-keys
+   "[TeX-next-error]"))
+ )
+(setq TeX-command-next TeX-command-default)
+;; error reported to TeX-error-report-switches
+(setq TeX-error-report-switches
+  (plist-put TeX-error-report-switches
+ (intern (plist-get TeX-error-report-switches
+'TeX-current-master))
+ t))
+t)
+;; In case that there were only non-error warnings of type
+;; bug#55065, restore point to the initial position.
+(goto-char (point-min))
+(setq TeX-command-next TeX-command-Show)
+nil))
+
+
 (defun TeX-ConTeXt-sentinel (process name)
-  "Cleanup TeX output buffer after running ConTeXt."
-  (cond
-   ;; Mark IV
-   ((with-current-buffer TeX-command-buffer
-  (string= ConTeXt-Mark-version "IV"))
-(cond ((TeX-TeX-sentinel-check process name))
-  ((re-search-forward "fatal error: " nil t)
-   (message (concat name ": problems after "
-(TeX-current-pages)))
-   (setq TeX-command-next TeX-command-default))
-  (t
-   (message (concat name ": successfully formatted "
-(TeX-current-pages)))
-   (setq TeX-command-next TeX-command-Show
-   ;; Mark II
-   (t
-(cond ((TeX-TeX-sentinel-check process name))
-  ((save-excursion
- ;; in a full ConTeXt run there will multiple texutil
- ;; outputs.  Just looking for "another run needed" would
- ;

bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-14 Thread Jim Diamond
On Sat, Feb 14, 2026 at 10:14 (+0100), Arash Esbati wrote:

> Jim Diamond  writes:

>> Well, I will say there were some very old memories that got somewhat
>> awakened.  But definitely the thought that I need to approach elisp
>> development in a more efficient manner next time.

> I suspect this means you will work further on ConTeXt support ;-)

Funny you should say that... see below.

>> I have no recollection of doing so.  Possibly in the distant past.

> I checked that now; you haven't done that in until now, so you have to
> start the process.

>> The form I got to from your link says
>> Please email the following information to [email protected]

>> Is that the correct place to send it for AUCTeX patches as well?

> Just fill this form:

> https://cgit.git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

> and send send it to [email protected].  I suggest you answer this question:

> [What is the name of the program or package you're contributing to?]

> with GNU Emacs and not with GNU AUCTeX.  This will make life easier if
> you contribute to Emacs itself at some point.

Arash, Ikumi and anyone else reading...

I did send that form in already, and heard nothing.  So I changed it as you
suggested and sent it again.  Maybe it will "take" this time.

I am attaching a second patch to this email.
-> It adds support for plain TeX so that
TeX-after-compilation-finished-functions
   is called after a successful compilation.

-> It adds support for ConTeXt so that
TeX-after-compilation-finished-functions
   is called after a successful compilation.
   (Yeah, that feature got lost in my first patch because I was following
   along the TeX-TeX-sentinel code when I rewrote TeX-ConTeXt-sentinel. Duh.)

Jim

>From 64593437edf7470f88c166efb0cf4ae58956213f Mon Sep 17 00:00:00 2001
From: Jim Diamond 
Date: Sat, 14 Feb 2026 12:31:36 -0400
Subject: [PATCH] Fix both plain TeX and my previous update to ConTeXt so that 
TeX-after-compilation-finished-functions are called after a compile
 attempt.

---
 context.el | 15 ---
 tex.el |  9 -
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/context.el b/context.el
index 7ff3f1cc..12bb4ebd 100644
--- a/context.el
+++ b/context.el
@@ -568,6 +568,7 @@ for a label to be inserted after the sectioning command."
 
 ;; Various
 
+;; This function is called with (current-buffer) = the output buffer.
 (defun TeX-ConTeXt-sentinel-check (process name)
   "Check ConTeXt (LMTX) output buffer after running TeX.
   Return  t  if errors were found."
@@ -624,7 +625,6 @@ for a label to be inserted after the sectioning command."
 )
 
 
-
 (defun TeX-ConTeXt-sentinel (process name)
   "Cleanup TeX output buffer after running ConTeXt.
 
@@ -637,8 +637,11 @@ for a label to be inserted after the sectioning command."
   
   (if (TeX-ConTeXt-sentinel-check process name)
   (progn
-   ;; Since ConTeXt LMTX stops after 1 error, it might make sense to
-   ;; just call (TeX-parse-error) once (and set the other variables
+   ;; ConTeXt LMTX stops after 1 error, unless heroic efforts
+   ;; are made by the user, and if such efforts are made the error 
+   ;; messages in the log file are not complete (at least as of 
+   ;; Version 2026.02.12) it might make sense to just call
+   ;; (TeX-parse-error) once (and set the other variables
;; as seen in (TeX-parse-all-errors)).
 (if TeX-parse-all-errors
 (TeX-parse-all-errors))
@@ -651,6 +654,12 @@ for a label to be inserted after the sectioning command."
   (message (concat name ": formatted " (TeX-current-pages)))
   (setq TeX-command-next TeX-command-Show)
)
+
+   (unless TeX-error-list
+   (run-hook-with-args 'TeX-after-compilation-finished-functions
+(with-current-buffer TeX-command-buffer
+  (expand-file-name 
+  (TeX-active-master (TeX-output-extension))
 )
 
 
diff --git a/tex.el b/tex.el
index fd806c66..201eed53 100644
--- a/tex.el
+++ b/tex.el
@@ -8572,7 +8572,14 @@ errors or warnings to show."
   (if (with-current-buffer TeX-command-buffer
 (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI
   (setq TeX-command-next dvi2pdf)
-(setq TeX-command-next TeX-command-Show)
+(setq TeX-command-next TeX-command-Show
+
+   (unless TeX-error-list
+   (run-hook-with-args 'TeX-after-compilation-finished-functions
+(with-current-buffer TeX-command-buffer
+  (expand-file-name 
+  (TeX-active-master (TeX-output-extension))
+)
 
 (defun TeX-current-pages ()
   "Return string indicating the number of pages formatted."
-- 
2.46.4

___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-14 Thread Arash Esbati
Jim Diamond  writes:

> Well, I will say there were some very old memories that got somewhat
> awakened.  But definitely the thought that I need to approach elisp
> development in a more efficient manner next time.

I suspect this means you will work further on ConTeXt support ;-)

> I have no recollection of doing so.  Possibly in the distant past.

I checked that now; you haven't done that in until now, so you have to
start the process.

> The form I got to from your link says
> Please email the following information to [email protected]
>
> Is that the correct place to send it for AUCTeX patches as well?

Just fill this form:

https://cgit.git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future

and send send it to [email protected].  I suggest you answer this question:

[What is the name of the program or package you're contributing to?]

with GNU Emacs and not with GNU AUCTeX.  This will make life easier if
you contribute to Emacs itself at some point.

Best, Arash



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work: PATCH ATTACHED

2026-02-13 Thread Jim Diamond
On Thu, Feb 12, 2026 at 15:54 (+0100), Arash Esbati wrote:

> Hi Jim,

> Jim Diamond  writes:

>> after some further poking and prodding, it seemed to me that some
>> significant development was needed.  Aside from the issues I mentioned
>> previously, in ConTeXt Mk IV and LMTX, the error message format is
>> different than (e.g., pdftex) (and Hans Hagen confirmed that the old
>> error message format is not coming back to this world).

> Many thanks for working on this; I hope you had fun hacking on Emacs
> again :-)

>> I have modified tex.el and context.el, and it now works (more or less) as
>> expected.  I want to do a bit more testing, but I think I am close to done.

> Great!

>> When I am done, how do I get my changes accepted?
>> -> Should I email the new files (or diffs) to someone?  If so, who?
>> -> Should I email the files (or diffs) to this bug report?

> We appreciate 'git format-patch' method attached to a mail sent to this
> bug report.  We closely follow Emacs in this regard, so if you're
> looking for details, have a look at this file[1].

> I can't check right now, have you signed the FSF copyright assignment?
> We need that for larger changes, otherwise we can't incorporate your
> change.

> Best, Arash

> Footnotes:
> [1]  https://cgit.git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE

Hi,

attached is a patch that I created with git format-patch.  I hope this is
the expected format for the patch.

If there are any questions, please let me know.

Cheers.
Jim

P.S. I filled in the form to do the copyright assignment yesterday, but I
haven't received anything back yet on that.  But I guess whomever needs to
review this patch can do so without the copyright assignment, in
expectation that it will appear soon.
>From d0b0fe34f9350db07944a7cdf477842b378f Mon Sep 17 00:00:00 2001
From: Jim Diamond 
Date: Fri, 13 Feb 2026 21:34:52 -0400
Subject: [PATCH] Updates to make C-c ` work in ConTeXt (LMTX and probably Mk
 IV).

---
 context.el | 127 +++--
 tex.el |  91 +-
 2 files changed, 164 insertions(+), 54 deletions(-)

diff --git a/context.el b/context.el
index 25cbeb34..7ff3f1cc 100644
--- a/context.el
+++ b/context.el
@@ -567,50 +567,91 @@ for a label to be inserted after the sectioning command."
 
 
 ;; Various
+
+(defun TeX-ConTeXt-sentinel-check (process name)
+  "Check ConTeXt (LMTX) output buffer after running TeX.
+  Return  t  if errors were found."
+
+  ;; First, determine which page was being worked on when an error happened,
+  ;; if any.  Also determine the extension of the output file.
+  (save-excursion
+  (goto-char (point-max))
+  (if (re-search-backward " > flushing realpage \\([0-9]+\\), " nil t)
+ (setq TeX-current-page (TeX-match-buffer 1))
+ (setq TeX-current-page "0")
+  )
+  ;; Unlike pdftex (and similar), ConTeXt LMTX only outputs page
+  ;; information as each one is successfully output.  Deal with it.
+  (setq TeX-current-page 
+   (concat "{" 
+   (number-to-string 
+(+ 1 (string-to-number TeX-current-page)))
+   "}"))
+  (setq TeX-output-extension "pdf")   ;; for the last 200 years now, +/-.
+  )
+
+  (if process (TeX-format-mode-line process))
+  
+  (if (catch 'found
+(while (re-search-forward 
+   "^\\(?:.*tex error on line [0-9]+ in file \\(.+?\\):\\)" nil t)
+(if (or (not (match-beginning 1))
+  ;; Ignore non-error warning. (bug#55065)
+  (file-exists-p (TeX-match-buffer 1)))
+  (throw 'found t
+ (progn
+  (if TeX-error-overview-open-after-TeX-run
+ ;; Don't leave inconsistent message.
+ (message nil)
+ (message "%s errors in `%s'. Use %s to display." 
+  name (buffer-name) 
+  (substitute-command-keys
+   "[TeX-next-error]"))
+  )
+(setq TeX-command-next TeX-command-default)
+;; error reported to TeX-error-report-switches
+(setq TeX-error-report-switches
+  (plist-put TeX-error-report-switches
+ (intern (plist-get TeX-error-report-switches
+'TeX-current-master))
+ t))
+t)
+;; In case that there were only non-error warnings of type
+;; bug#55065, restore point to the initial position.
+(goto-char (point-min))
+(setq TeX-command-next TeX-command-Show)
+nil)
+)
+
+
+
 (defun TeX-ConTeXt-sentinel (process name)
-  "Cleanup TeX output buffer after running ConTeXt."
-  (cond
-   ;; Mark IV
-   ((with-current-buffer TeX-command-buffer
-  (string= ConTeXt-Mark-version "IV"))
-(cond ((TeX-TeX-sentinel-check process name))
-  ((re-sear

bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-12 Thread Jim Diamond
On Thu, Feb 12, 2026 at 15:54 (+0100), Arash Esbati wrote:

> Hi Jim,

> Jim Diamond  writes:

>> after some further poking and prodding, it seemed to me that some
>> significant development was needed.  Aside from the issues I mentioned
>> previously, in ConTeXt Mk IV and LMTX, the error message format is
>> different than (e.g., pdftex) (and Hans Hagen confirmed that the old
>> error message format is not coming back to this world).

> Many thanks for working on this; I hope you had fun hacking on Emacs
> again :-)

Well, I will say there were some very old memories that got somewhat
awakened.  But definitely the thought that I need to approach elisp
development in a more efficient manner next time.

>> I have modified tex.el and context.el, and it now works (more or less) as
>> expected.  I want to do a bit more testing, but I think I am close to done.

> Great!

I sent my changes to the context mailing list looking for beta testers.
Unfortunately, the files are big enough to trigger a "needs blessing by
moderator" check.

>> When I am done, how do I get my changes accepted?
>> -> Should I email the new files (or diffs) to someone?  If so, who?
>> -> Should I email the files (or diffs) to this bug report?

> We appreciate 'git format-patch' method attached to a mail sent to this
> bug report.  We closely follow Emacs in this regard, so if you're looking
> for details, have a look at this file[1].

Ho hum.  It was so much easier to send patches before git was invented.

> I can't check right now, have you signed the FSF copyright assignment?

I have no recollection of doing so.  Possibly in the distant past.

> We need that for larger changes, otherwise we can't incorporate your
> change.

The form I got to from your link says
Please email the following information to [email protected]

Is that the correct place to send it for AUCTeX patches as well?

Thanks for your help moving this forward.

Jim



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-12 Thread Arash Esbati
Hi Jim,

Jim Diamond  writes:

> after some further poking and prodding, it seemed to me that some
> significant development was needed.  Aside from the issues I mentioned
> previously, in ConTeXt Mk IV and LMTX, the error message format is
> different than (e.g., pdftex) (and Hans Hagen confirmed that the old
> error message format is not coming back to this world).

Many thanks for working on this; I hope you had fun hacking on Emacs
again :-)

> I have modified tex.el and context.el, and it now works (more or less) as
> expected.  I want to do a bit more testing, but I think I am close to done.

Great!

> When I am done, how do I get my changes accepted?
> -> Should I email the new files (or diffs) to someone?  If so, who?
> -> Should I email the files (or diffs) to this bug report?

We appreciate 'git format-patch' method attached to a mail sent to this
bug report.  We closely follow Emacs in this regard, so if you're
looking for details, have a look at this file[1].

I can't check right now, have you signed the FSF copyright assignment?
We need that for larger changes, otherwise we can't incorporate your
change.

Best, Arash

Footnotes:
[1]  https://cgit.git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-12 Thread Jim Diamond
Hi,

after some further poking and prodding, it seemed to me that some
significant development was needed.  Aside from the issues I mentioned
previously, in ConTeXt Mk IV and LMTX, the error message format is
different than (e.g., pdftex) (and Hans Hagen confirmed that the old error
message format is not coming back to this world).

Because of the different format, various regexps needed changing, and in
other places it seemed more sensible to refactor some code.

I have modified tex.el and context.el, and it now works (more or less) as
expected.  I want to do a bit more testing, but I think I am close to done.

When I am done, how do I get my changes accepted?
-> Should I email the new files (or diffs) to someone?  If so, who?
-> Should I email the files (or diffs) to this bug report?

Please advise, thanks.

Jim

On Mon, Feb  9, 2026 at 21:12 (-0400), Jim Diamond wrote:

> Hi Ikumi and Arash (and anyone else looking at this),

> after poking around for a bit, I've come to the conclusion that the bulk of
> the problem (if not all of it) is TeX-ConTeXt-sentinel.

> First, there is some peculiar code in there.  For example, I see
>(cond ((TeX-TeX-sentinel-check process name))
> which has a CONDITION, but not a BODY.  It doesn't make sense to me,
> although maybe there is some side-effect or some other thing that elisp
> wizards recognize, but I don't.

> Second, unlike TeX-TeX-sentinel and TeX-LaTeX-sentinel, it (apparently)
> doesn't attempt to parse the errors.

> Third, the comment for the ConTeXt version of that function doesn't say
> Parse the output buffer to collect errors and warnings if the
> variable `TeX-parse-all-errors' is non-nil.

> Open the error overview if
> `TeX-error-overview-open-after-TeX-run' is non-nil and there are
> errors or warnings to show."
> unlike the other two.

> Fourth, when I change context.el to have
>   (setq TeX-sentinel-default-function #'TeX-TeX-sentinel))
> instead of
>   (setq TeX-sentinel-default-function #'TeX-ConTeXt-sentinel))
> then C-c ` actually does something (sort of) sensible.
> -> It doesn't parse things correctly, so the *TeX Help* buffer doesn't have
> the complete error message, and
> -> It complains "Could not determine file for error" and replaces the
> window showing the ConTeXt file with a window showing the actual output.
>(Which means you do get to see the error, but your TeX file is no longer
> visible.)
>(The same problem happens if I try TeX-LaTeX-sentinel.)


> I don't see how TeX-ConTeXt-sentinel() ever did anything useful.  But it
> has been around a long time, so maybe it worked back in ConTeXt MkII days.


> I would guess (someone familiar with the AUCTeX code base might want to
> comment on this) that a whole new TeX-ConTeXt-sentinel() function is
> needed, and perhaps TeX-find-display-help() needs some help as well.

> Thoughts?

> Jim



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Jim Diamond
Hi Ikumi and Arash (and anyone else looking at this),

after poking around for a bit, I've come to the conclusion that the bulk of
the problem (if not all of it) is TeX-ConTeXt-sentinel.

First, there is some peculiar code in there.  For example, I see
   (cond ((TeX-TeX-sentinel-check process name))
which has a CONDITION, but not a BODY.  It doesn't make sense to me,
although maybe there is some side-effect or some other thing that elisp
wizards recognize, but I don't.

Second, unlike TeX-TeX-sentinel and TeX-LaTeX-sentinel, it (apparently)
doesn't attempt to parse the errors.

Third, the comment for the ConTeXt version of that function doesn't say
Parse the output buffer to collect errors and warnings if the
variable `TeX-parse-all-errors' is non-nil.

Open the error overview if
`TeX-error-overview-open-after-TeX-run' is non-nil and there are
errors or warnings to show."
unlike the other two.

Fourth, when I change context.el to have
  (setq TeX-sentinel-default-function #'TeX-TeX-sentinel))
instead of
  (setq TeX-sentinel-default-function #'TeX-ConTeXt-sentinel))
then C-c ` actually does something (sort of) sensible.
-> It doesn't parse things correctly, so the *TeX Help* buffer doesn't have
   the complete error message, and
-> It complains "Could not determine file for error" and replaces the
   window showing the ConTeXt file with a window showing the actual output.
   (Which means you do get to see the error, but your TeX file is no longer
   visible.)
   (The same problem happens if I try TeX-LaTeX-sentinel.)


I don't see how TeX-ConTeXt-sentinel() ever did anything useful.  But it
has been around a long time, so maybe it worked back in ConTeXt MkII days.


I would guess (someone familiar with the AUCTeX code base might want to
comment on this) that a whole new TeX-ConTeXt-sentinel() function is
needed, and perhaps TeX-find-display-help() needs some help as well.

Thoughts?

Jim



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Jim Diamond
Hi again Arash,

see below.

On Mon, Feb  9, 2026 at 20:08 (+0100), Arash Esbati wrote:

> Jim Diamond  writes:

>> Unfortunately, not.

> I thought so, but thanks for confirming.

>> Did that change do anything for you?

> Yes, AUCTeX now says:

> ConTeXt: problems after [0] pages

How odd.  I wasn't seeing that until I modified TeX-ConTeXt-sentinel()
where I deleted the line
(re-search-forward "fatal error: " nil t)
and added the line
(re-search-forward "tex error: " nil t)
since there is no "fatal error" to be found in my output.

Incidentally... just for certainty, are you running ConTeXt LMTX, and a
relatively recent version of that?  When I run
context --version
(from the command line) I get
mtx-context | ConTeXt Process Management 1.06
mtx-context |
mtx-context | main context file: 
/usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2026.01.07 10:59
mtx-context | main context file: 
/usr/local/context/tex/texmf-context/tex/context/base/mkxl/context.mkxl
mtx-context | current version: 2026.01.07 10:59

>> In my case, it didn't even give me the "... errors ... Use C-c ` to
>> display" message.

> ConTeXt errors in ‘*foo output*’. Use C-c ` to display.
> is still emitted, it comes just before the other message above, but
> we're not still there.

With your (not ) in that (cond ) I get the message about errors when I
compile a document without errors, and vice versa.  This is very curious.

Does not reversing the logic there give you this message
(I get it, anyway):
 ConTeXt Full errors in ‘*/tmp/ccc-short output*’. Use C-c ` to display.
when you compile a document without errors?


>> Seeing "Mark IV" in that code did give me one concern...
>> I suspect most (if not virtually all) ConTeXt users at now using LMTX.
>> I wonder if any differences between MkIV and LMTX are significant for
>> AUCTeX.

> Yes, you see that ConTeXt support in AUCTeX didn't receive much love
> lately.  It would be great if Someone™ would start updating that part.

I know, if only we could find that Someone™ :-)

I have started looking at the code, but I think it will take me a while to
understand what is going on.  For example, it seems (maybe I'm wrong here)
that the plain TeX mode code path is similar to that of LaTeX mode, but
ConTeXt seems to wander off path a fair ways.

I don't know whether this is a good or a bad thing, vis-a-vis people like
me understanding the code well enough to contribute; I don't really want to
know or care about LaTeX-specific things (because I don't use LaTeX), but
if that is the most straightforward code path, then perhaps understanding
it would give some insight as to why ConTeXt is different.

Or maybe it isn't as different as I think, but I will have to study more.


>> FWIW, I don't follow you there.  Isn't there a search for "fatal error"
>> exactly when TeX-TeX-sentinel-check returns non-nil?

> This is `TeX-ConTeXt-sentinel':

>   (defun TeX-ConTeXt-sentinel (process name)
> "Cleanup TeX output buffer after running ConTeXt."
> (cond
>  ;; Mark IV
>  ((with-current-buffer TeX-command-buffer
> (string= ConTeXt-Mark-version "IV"))
>   (cond ((TeX-TeX-sentinel-check process name))
> ((re-search-forward "fatal error: " nil t)
>  (message (concat name ": problems after "
>   (TeX-current-pages)))
>  (setq TeX-command-next TeX-command-default))
> (t
>  (message (concat name ": successfully formatted "
>   (TeX-current-pages)))
>  (setq TeX-command-next TeX-command-Show
>   ...

> Running your example gives:

>   ! Undefined control sequence
> tex error   > tex error on line 4 in file ./context-test.tex:

> `TeX-ConTeXt-sentinel' runs (TeX-TeX-sentinel-check process name) which
> sees ! at the beginning of line and returs non-nil

(In the case of an error...)
(I will take your word for it triggering on a '^!', I haven't got that far
yet.)

> (`TeX-TeX-sentinel-check' returns nil if it doesn't find an error).  So
> the search for "fatal error: " isn't run.  Or am I missing something?

Yes and no?

First, since ConTeXt does not (in 2026 anyway) output "fatal error"
(AFAICT), there is no point looking for it.  So I think one way or the
other that line wants to be updated.

Second, if TeX-TeX-sentinel-check doesn't find an error, then is it not the
case that we *don't* want to search for "fatal error" (or even "tex error") ?

>> Further, ConTeXt (apparently) never outputs "fatal error", so
>> searching for that doesn't seem fruitful.

> This is what I see when I run the example I sent upthread:

> --8<---cut here---start->8---
> ! Undefined control sequence
> tex error   > tex error on line 4 in file ./context-test.tex: 



> Do you see something d

bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Arash Esbati
Jim Diamond  writes:

> Unfortunately, not.

I thought so, but thanks for confirming.

> Did that change do anything for you?

Yes, AUCTeX now says:

  ConTeXt: problems after [0] pages

> In my case, it didn't even give me the "... errors ... Use C-c ` to
> display" message.

  ConTeXt errors in ‘*foo output*’. Use C-c ` to display.

is still emitted, it comes just before the other message above, but
we're not still there.

> Seeing "Mark IV" in that code did give me one concern...
> I suspect most (if not virtually all) ConTeXt users at now using LMTX.
> I wonder if any differences between MkIV and LMTX are significant for
> AUCTeX.

Yes, you see that ConTeXt support in AUCTeX didn't receive much love
lately.  It would be great if Someone™ would start updating that part.

> FWIW, I don't follow you there.  Isn't there a search for "fatal error"
> exactly when TeX-TeX-sentinel-check returns non-nil?

This is `TeX-ConTeXt-sentinel':

  (defun TeX-ConTeXt-sentinel (process name)
"Cleanup TeX output buffer after running ConTeXt."
(cond
 ;; Mark IV
 ((with-current-buffer TeX-command-buffer
(string= ConTeXt-Mark-version "IV"))
  (cond ((TeX-TeX-sentinel-check process name))
((re-search-forward "fatal error: " nil t)
 (message (concat name ": problems after "
  (TeX-current-pages)))
 (setq TeX-command-next TeX-command-default))
(t
 (message (concat name ": successfully formatted "
  (TeX-current-pages)))
 (setq TeX-command-next TeX-command-Show
  ...

Running your example gives:

  ! Undefined control sequence
  tex error   > tex error on line 4 in file ./context-test.tex:

`TeX-ConTeXt-sentinel' runs (TeX-TeX-sentinel-check process name) which
sees ! at the beginning of line and returs non-nil
(`TeX-TeX-sentinel-check' returns nil if it doesn't find an error).  So
the search for "fatal error: " isn't run.  Or am I missing something?

> Further, ConTeXt (apparently) never outputs "fatal error", so
> searching for that doesn't seem fruitful.

This is what I see when I run the example I sent upthread:

--8<---cut here---start->8---
! Undefined control sequence
tex error   > tex error on line 4 in file ./context-test.tex: 

 
\xyzzy

 1 
 2 
 3 \starttext
 4 >>  \xyzzy
 5 \stoptext
 6 
 7 %%% Local Variables:
 8 %%% mode: ConTeXt
 9 %%% TeX-master: t
10 %%% ConTeXt-Mark-version: "IV"
11 %%% End:
12 
The control sequence at the end of the top line of your error message
was never\def'ed. You can just continue as I'll forget about whatever
was undefined.
mtx-context | fatal error: return code: 1
--8<---cut here---end--->8---

Do you see something different?

Does ConTeXt have a command-line switch in order to emit usual TeX
errors instead of the above?  Maybe that's enough for us?

Best, Arash



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Jim Diamond
On Mon, Feb  9, 2026 at 16:31 (+0100), Arash Esbati wrote:

> Hi Keita,

> Ikumi Keita  writes:

>> Thank you for your report. Though I haven't understand the culprit yet,
>> I noticed a difference between `TeX-LaTeX-sentinel' and
>> `TeX-ConTeXt-sentinel'. Could you try the following patch if you know
>> how to use it?

>> diff --git a/context.el b/context.el
>> index 25cbeb34..d248859f 100644
>> --- a/context.el
>> +++ b/context.el
>> @@ -606,7 +606,7 @@ for a label to be inserted after the sectioning command."
>> (message (concat name ": problems after "
>>  (TeX-current-pages)))
>> (setq TeX-command-next TeX-command-default)
>> -  (unless TeX-error-list
>> +  (unless (TeX-error-report-has-errors-p)
>>  (run-hook-with-args 'TeX-after-compilation-finished-functions
>>  (with-current-buffer TeX-command-buffer
>>(expand-file-name

> Thanks for looking at this issue.  I applied your suggestion and tried
> it, but no avail.  Maybe Jim has different results.

Unfortunately, not.

> I only had a brief look, and I think we have to touch
> `TeX-TeX-sentinel-check' again.  First, I think we should do this to
> context.el:

> --8<---cut here---start->8---
> diff --git a/context.el b/context.el
> index 25cbeb34..001d765f 100644
> --- a/context.el
> +++ b/context.el
> @@ -573,7 +573,7 @@ for a label to be inserted after the sectioning command."
> ;; Mark IV
> ((with-current-buffer TeX-command-buffer
>(string= ConTeXt-Mark-version "IV"))
> -(cond ((TeX-TeX-sentinel-check process name))
> +(cond ((not (TeX-TeX-sentinel-check process name)))
>((re-search-forward "fatal error: " nil t)
> (message (concat name ": problems after "
>  (TeX-current-pages)))
> --8<---cut here---end--->8---

Did that change do anything for you?  In my case, it didn't even give me
the "... errors ... Use C-c ` to display" message.


Seeing "Mark IV" in that code did give me one concern...
I suspect most (if not virtually all) ConTeXt users at now using LMTX.
I wonder if any differences between MkIV and LMTX are significant for
AUCTeX.

> ,[ C-h f TeX-TeX-sentinel-check RET ]
>> TeX-TeX-sentinel-check is a native-comp-function in ‘tex.el’.

>> (TeX-TeX-sentinel-check PROCESS NAME)

>> Cleanup TeX output buffer after running TeX.
>> Return nil only if no errors were found.

> `

> In the case above, the first cond-clause wins because
> `TeX-TeX-sentinel-check' returns non-nil (it finds an error), so the
> search for "fatal error" never happens.

FWIW, I don't follow you there.  Isn't there a search for "fatal error"
exactly when TeX-TeX-sentinel-check returns non-nil?

Further, ConTeXt (apparently) never outputs "fatal error", so searching for
that doesn't seem fruitful.

> Next, ConTeXt emits a "fancy" error message.  Consider this file:

> --8<---cut here---start->8---
> \starttext
> \xyzzy
> \stoptext

> %%% Local Variables:
> %%% mode: ConTeXt
> %%% TeX-master: t
> %%% ConTeXt-Mark-version: "IV"
> %%% End:
> --8<---cut here---end--->8---

> Running context on it says:

> --8<---cut here---start->8---
> ! Undefined control sequence
> tex error   > tex error on line 2 in file ./context-test.tex: 

> 
> --8<---cut here---end--->8---

> Now take this plain-TeX file:

> --8<---cut here---start->8---
> % \starttext
> \xyzzy
> % \stoptext

> %%% Local Variables:
> %%% mode: plain-TeX
> %%% TeX-master: t
> %%% End:
> --8<---cut here---end--->8---

> Running tex on it gives:

> --8<---cut here---start->8---
> (./context-test.tex
> ./context-test.tex:4: Undefined control sequence.
> l.4 \xyzzy

> )
> --8<---cut here---end--->8---

> which AUCTeX parses correctly.  Again, I only had a very brief look, so
> apologies if the above is off.

Cheers.
Jim



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Arash Esbati
Hi Keita,

Ikumi Keita  writes:

> Thank you for your report. Though I haven't understand the culprit yet,
> I noticed a difference between `TeX-LaTeX-sentinel' and
> `TeX-ConTeXt-sentinel'. Could you try the following patch if you know
> how to use it?
>
> diff --git a/context.el b/context.el
> index 25cbeb34..d248859f 100644
> --- a/context.el
> +++ b/context.el
> @@ -606,7 +606,7 @@ for a label to be inserted after the sectioning command."
> (message (concat name ": problems after "
>  (TeX-current-pages)))
> (setq TeX-command-next TeX-command-default)
> -  (unless TeX-error-list
> +  (unless (TeX-error-report-has-errors-p)
>  (run-hook-with-args 'TeX-after-compilation-finished-functions
>  (with-current-buffer TeX-command-buffer
>(expand-file-name

Thanks for looking at this issue.  I applied your suggestion and tried
it, but no avail.  Maybe Jim has different results.

I only had a brief look, and I think we have to touch
`TeX-TeX-sentinel-check' again.  First, I think we should do this to
context.el:

--8<---cut here---start->8---
diff --git a/context.el b/context.el
index 25cbeb34..001d765f 100644
--- a/context.el
+++ b/context.el
@@ -573,7 +573,7 @@ for a label to be inserted after the sectioning command."
;; Mark IV
((with-current-buffer TeX-command-buffer
   (string= ConTeXt-Mark-version "IV"))
-(cond ((TeX-TeX-sentinel-check process name))
+(cond ((not (TeX-TeX-sentinel-check process name)))
   ((re-search-forward "fatal error: " nil t)
(message (concat name ": problems after "
 (TeX-current-pages)))
--8<---cut here---end--->8---

,[ C-h f TeX-TeX-sentinel-check RET ]
| TeX-TeX-sentinel-check is a native-comp-function in ‘tex.el’.
| 
| (TeX-TeX-sentinel-check PROCESS NAME)
| 
| Cleanup TeX output buffer after running TeX.
| Return nil only if no errors were found.
| 
`

In the case above, the first cond-clause wins because
`TeX-TeX-sentinel-check' returns non-nil (it finds an error), so the
search for "fatal error" never happens.

Next, ConTeXt emits a "fancy" error message.  Consider this file:

--8<---cut here---start->8---
\starttext
\xyzzy
\stoptext

%%% Local Variables:
%%% mode: ConTeXt
%%% TeX-master: t
%%% ConTeXt-Mark-version: "IV"
%%% End:
--8<---cut here---end--->8---

Running context on it says:

--8<---cut here---start->8---
! Undefined control sequence
tex error   > tex error on line 2 in file ./context-test.tex: 


--8<---cut here---end--->8---

Now take this plain-TeX file:

--8<---cut here---start->8---
% \starttext
\xyzzy
% \stoptext

%%% Local Variables:
%%% mode: plain-TeX
%%% TeX-master: t
%%% End:
--8<---cut here---end--->8---

Running tex on it gives:

--8<---cut here---start->8---
(./context-test.tex
./context-test.tex:4: Undefined control sequence.
l.4 \xyzzy

)
--8<---cut here---end--->8---

which AUCTeX parses correctly.  Again, I only had a very brief look, so
apologies if the above is off.

Best, Arash



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Jim Diamond
Hi Ikumi,

thanks for your quick response.

Please see below.

On Mon, Feb  9, 2026 at 23:23 (+0900), Ikumi Keita wrote:

> Hi Jim,

>> Jim Diamond  writes:
>> (7) I understand that there may be no ConTeXt users at AUCTeX headquarters,
>> so here is a very small ConTeXt file showing the problem:

>> %%% cut here %%%
>> \starttext
>> \xyzzy
>> \stoptext
>> %%% cut here %%%

>> Here is the complete error message in that case:

>> <>
>> ! Undefined control sequence
>> tex error   > tex error on line 2 in file ./a.tex: 

>>  
>> \xyzzy

>> 1 \starttext
>> 2 >>  \xyzzy
>> 3 \stoptext
>> 4 
>> The control sequence at the end of the top line of your error message was 
>> never\def'ed. You can just continue as I'll forget about whatever was 
>> undefined.
>> mtx-context | fatal error: return code: 1

>> TeX Output exited abnormally with code 1 at Sat Feb  7 14:42:40

> Thank you for your report. Though I haven't understand the culprit yet,
> I noticed a difference between `TeX-LaTeX-sentinel' and
> `TeX-ConTeXt-sentinel'. Could you try the following patch if you know
> how to use it?

> diff --git a/context.el b/context.el
> index 25cbeb34..d248859f 100644
> --- a/context.el
> +++ b/context.el
> @@ -606,7 +606,7 @@ for a label to be inserted after the sectioning command."
> (message (concat name ": problems after "
>  (TeX-current-pages)))
> (setq TeX-command-next TeX-command-default)
> -  (unless TeX-error-list
> +  (unless (TeX-error-report-has-errors-p)
>  (run-hook-with-args 'TeX-after-compilation-finished-functions
>  (with-current-buffer TeX-command-buffer
>(expand-file-name

I applied that patch, but unfortunately I get the same result.
(That is, it says "No more errors.")

> Unfortunately, I can't test it by myself because my current TeX Live
> installation seems to be partially broken; ConTeXt gives me mysterious
> message and refuses to run normally like this, even for normal ConTeXt
> file.😵
> vv
> Running `ConTeXt' on `cont-eng' with ``context --once  --nonstop 
> cont-eng.tex''mtxrun  | forcing cache reload
> resolvers   | resolving | looking for regular 'texmfcnf.lua' on given 
> path '/home/keita/texmf/web2c' from specification 'home:texmf/web2c'
> resolvers   | resolving | looking for regular 'texmfcnf.lua' on given 
> path '/usr/texmf-local/web2c' from specification 
> 'selfautoparent:/texmf-local/web2c'
> resolvers   | resolving | looking for regular 'texmfcnf.lua' on given 
> path '/usr/texmf-context/web2c' from specification 
> 'selfautoparent:/texmf-context/web2c'
> resolvers   | resolving | looking for regular 'texmfcnf.lua' on given 
> path '/usr/texmf/web2c' from specification 'selfautoparent:/texmf/web2c'
> resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
> path '/home/keita/texmf/web2c' from specification 'home:texmf/web2c'
> resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
> path '/usr/texmf-local/web2c' from specification 
> 'selfautoparent:/texmf-local/web2c'
> resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
> path '/usr/texmf-context/web2c' from specification 
> 'selfautoparent:/texmf-context/web2c'
> resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
> path '/usr/texmf/web2c' from specification 'selfautoparent:/texmf/web2c'
> resolvers   | resolving |
> resolvers   | resolving | warning: no lua configuration files found
> resolvers   | resolving | no texmf paths are defined (using TEXMF)
> resolvers   | resolving |
> mtxrun  | the resolver databases are not present or outdated
> resolvers   | resolving | using suffix based filetype 'lua'
> resolvers   | resolving | remembering file 'mtx-context.lua' using hash 
> 'lua::mtx-context.lua'
> resolvers   | resolving | using suffix based filetype 'lua'
> resolvers   | resolving | remembering file 'mtx-contexts.lua' using hash 
> 'lua::mtx-contexts.lua'
> resolvers   | resolving | remembered file 'mtx-context.lua'
> resolvers   | resolving | using suffix based filetype 'lua'
> resolvers   | resolving | remembering file 'mtx-t-mtx-context.lua' using 
> hash 'lua::mtx-t-mtx-context.lua'
> resolvers   | resolving | using suffix based filetype 'lua'
> resolvers   | resolving | remembering file 'mtx-t-mtx-contexts.lua' using 
> hash 'lua::mtx-t-mtx-contexts.lua'
> resolvers   | resolving | remembered file 'mtx-t-mtx-context.lua'
> resolvers   | resolving | remembered file 'mtx-context.lua'
> mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'


> TeX Output finished at Sun Feb  8 19:14:59
> ^^

bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-09 Thread Ikumi Keita
Hi Jim,

> Jim Diamond  writes:
> (7) I understand that there may be no ConTeXt users at AUCTeX headquarters,
> so here is a very small ConTeXt file showing the problem:

> %%% cut here %%%
> \starttext
> \xyzzy
> \stoptext
> %%% cut here %%%

> Here is the complete error message in that case:

> <>
> ! Undefined control sequence
> tex error   > tex error on line 2 in file ./a.tex: 

>  
> \xyzzy

> 1 \starttext
> 2 >>  \xyzzy
> 3 \stoptext
> 4 
> The control sequence at the end of the top line of your error message was 
> never\def'ed. You can just continue as I'll forget about whatever was 
> undefined.
> mtx-context | fatal error: return code: 1

> TeX Output exited abnormally with code 1 at Sat Feb  7 14:42:40

Thank you for your report. Though I haven't understand the culprit yet,
I noticed a difference between `TeX-LaTeX-sentinel' and
`TeX-ConTeXt-sentinel'. Could you try the following patch if you know
how to use it?

diff --git a/context.el b/context.el
index 25cbeb34..d248859f 100644
--- a/context.el
+++ b/context.el
@@ -606,7 +606,7 @@ for a label to be inserted after the sectioning command."
(message (concat name ": problems after "
 (TeX-current-pages)))
(setq TeX-command-next TeX-command-default)
-  (unless TeX-error-list
+  (unless (TeX-error-report-has-errors-p)
 (run-hook-with-args 'TeX-after-compilation-finished-functions
 (with-current-buffer TeX-command-buffer
   (expand-file-name

Unfortunately, I can't test it by myself because my current TeX Live
installation seems to be partially broken; ConTeXt gives me mysterious
message and refuses to run normally like this, even for normal ConTeXt
file.😵
vv
Running `ConTeXt' on `cont-eng' with ``context --once  --nonstop 
cont-eng.tex''mtxrun  | forcing cache reload
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/home/keita/texmf/web2c' from specification 'home:texmf/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/texmf-local/web2c' from specification 'selfautoparent:/texmf-local/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/texmf-context/web2c' from specification 
'selfautoparent:/texmf-context/web2c'
resolvers   | resolving | looking for regular 'texmfcnf.lua' on given path 
'/usr/texmf/web2c' from specification 'selfautoparent:/texmf/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
path '/home/keita/texmf/web2c' from specification 'home:texmf/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
path '/usr/texmf-local/web2c' from specification 
'selfautoparent:/texmf-local/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
path '/usr/texmf-context/web2c' from specification 
'selfautoparent:/texmf-context/web2c'
resolvers   | resolving | looking for fallback 'contextcnf.lua' on given 
path '/usr/texmf/web2c' from specification 'selfautoparent:/texmf/web2c'
resolvers   | resolving |
resolvers   | resolving | warning: no lua configuration files found
resolvers   | resolving | no texmf paths are defined (using TEXMF)
resolvers   | resolving |
mtxrun  | the resolver databases are not present or outdated
resolvers   | resolving | using suffix based filetype 'lua'
resolvers   | resolving | remembering file 'mtx-context.lua' using hash 
'lua::mtx-context.lua'
resolvers   | resolving | using suffix based filetype 'lua'
resolvers   | resolving | remembering file 'mtx-contexts.lua' using hash 
'lua::mtx-contexts.lua'
resolvers   | resolving | remembered file 'mtx-context.lua'
resolvers   | resolving | using suffix based filetype 'lua'
resolvers   | resolving | remembering file 'mtx-t-mtx-context.lua' using 
hash 'lua::mtx-t-mtx-context.lua'
resolvers   | resolving | using suffix based filetype 'lua'
resolvers   | resolving | remembering file 'mtx-t-mtx-contexts.lua' using 
hash 'lua::mtx-t-mtx-contexts.lua'
resolvers   | resolving | remembered file 'mtx-t-mtx-context.lua'
resolvers   | resolving | remembered file 'mtx-context.lua'
mtxrun  | unknown script 'mtx-context.lua' or 'mtx-mtx-context.lua'


TeX Output finished at Sun Feb  8 19:14:59
^^

> (8) If I can be of any assistance testing a fix, don't hesitate to get back
> to me.

Thank you for your cooperation!

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopGenocide #CeasefireNOW



___
bug-auctex mailing list
[email protected]
https://lists.gnu.org/m

bug#80350: 14.1.2; Parsing ConTeXt output for errors doesn't work

2026-02-07 Thread Jim Diamond
Here are steps to demonstrate this bug:

(1) Use AUCTeX to edit a ConTeXt file.
(2) Compile with 
Alt-X TeX-command-master
ConTeXt
(3) Get an error because of a mistake in the ConTeXt file.
(4) See an invitation to display errors with this message:
ConTeXt Full errors in ‘*~/a output*’. Use C-c ` to display.
(5) Type
C-c `

***What I expect:***
(6) To see information about the error.
***What actually happens:***
(6') AUCTeX says
No more errors.

(7) I understand that there may be no ConTeXt users at AUCTeX headquarters,
so here is a very small ConTeXt file showing the problem:

%%% cut here %%%
\starttext
\xyzzy
\stoptext
%%% cut here %%%

Here is the complete error message in that case:

<>
! Undefined control sequence
tex error   > tex error on line 2 in file ./a.tex: 

 
\xyzzy

1 \starttext
2 >>  \xyzzy
3 \stoptext
4 
The control sequence at the end of the top line of your error message was 
never\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 1

TeX Output exited abnormally with code 1 at Sat Feb  7 14:42:40

(8) If I can be of any assistance testing a fix, don't hesitate to get back
to me.

Thanks!

Emacs  : GNU Emacs 30.2 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 
3.24.31, cairo version 1.16.0)
 of 2025-08-14
Package: 14.1.2

current state:
==
(setq
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex/"
  "/home/zsd/.emacs.d/elpa/auctex-14.1.2/style"
  "/home/zsd/.emacs.d/auctex/auto"
  "/home/zsd/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save nil
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX"
 "%(PDF)%(tex) %(file-line-error) %`%(extraopts) 
%S%(PDFout)%(mode)%' %(output-dir) %t"
 TeX-run-TeX nil (plain-TeX-mode AmSTeX-mode Texinfo-mode)
 :help "Run plain TeX")
("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil
 (LaTeX-mode docTeX-mode) :help "Run LaTeX")
("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t"
 TeX-run-compile nil (Texinfo-mode) :help
 "Run Makeinfo with Info output")
("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t"
 TeX-run-compile nil (Texinfo-mode) :help
 "Run Makeinfo with HTML output")
("AmSTeX"
 "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) 
%t"
 TeX-run-TeX nil (AmSTeX-mode) :help "Run AMSTeX")
("ConTeXt" "%(cntxcom) --once %(extraopts) %(execopts)%t"
 TeX-run-TeX nil (ConTeXt-mode) :help "Run ConTeXt once")
("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t"
 TeX-run-TeX nil (ConTeXt-mode) :help
 "Run ConTeXt until completion")
("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil
 (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode
  Texinfo-mode ConTeXt-mode)
 :help "Run BibTeX")
("Biber" "biber %(output-dir) %s" TeX-run-Biber nil
 (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode
  Texinfo-mode)
 :help "Run Biber")
("Texindex" "texindex %s.??" TeX-run-command nil
 (Texinfo-mode) :help "Run Texindex")
("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil
 (Texinfo-mode) :help "Run Texi2dvi or Texi2pdf")
("View" "%V" TeX-run-discard-or-function t t :help
 "Run Viewer")
("Print" "%p" TeX-run-command t t :help "Print the file")
("Queue" "%q" TeX-run-background nil t :help
 "View the printer queue" :visible TeX-queue-command)
("File" "%(o?)dvips %d -o %f " TeX-run-dvips t
 (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode
  Texinfo-mode)
 :help "Generate PostScript file")
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
 (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode
  Texinfo-mode)
 :help "Convert DVI file to PostScript")
("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil
 (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode
  Texinfo-mode)
 :help "Convert DVI file to PDF with dvipdfmx")
("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
 (plain-TeX-mode L