From unknown Wed Jun 18 00:25:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#48144 <48144@debbugs.gnu.org> To: bug#48144 <48144@debbugs.gnu.org> Subject: Status: 13.0.11; TeX-run-format signals error in sentinel Reply-To: bug#48144 <48144@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:25:30 +0000 retitle 48144 13.0.11; TeX-run-format signals error in sentinel reassign 48144 auctex submitter 48144 "Basil L. Contovounesios" severity 48144 normal tag 48144 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat May 01 12:15:45 2021 Received: (at submit) by debbugs.gnu.org; 1 May 2021 16:15:45 +0000 Received: from localhost ([127.0.0.1]:37094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcsHQ-0007Aw-Lv for submit@debbugs.gnu.org; Sat, 01 May 2021 12:15:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:57386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcsHP-0007Aq-1T for submit@debbugs.gnu.org; Sat, 01 May 2021 12:15:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcsHJ-0005tp-Ld for bug-auctex@gnu.org; Sat, 01 May 2021 12:15:42 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:38818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcsHF-0005hp-CB for bug-auctex@gnu.org; Sat, 01 May 2021 12:15:36 -0400 Received: by mail-wm1-x32d.google.com with SMTP id p6-20020a05600c3586b029014131bbe5c7so3270778wmq.3 for ; Sat, 01 May 2021 09:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:subject:date:message-id:user-agent:mime-version; bh=jTVydxXiQw+Qb1VSN+iZ2d5mx1Zvm473mfJdmRZIDD8=; b=QuHuELtHTR84bb0hGwLEQRW1oFIy2HqwalxotC0j3oSOPTtx/TcRrix0RXybTBOE4u gGe0W6YS4Dl1US9yrg5OFSowevj82csrsMEuIvGivkVE3yMXv5/wJnMLY5p8HUBW/lp0 f7Zlt3FJ/Te+2crHnPpfyRqu0HXCmvr4yZwiNi//0pzFFBTiRu1Eg7TdyCjUHKsVISRQ /aEnSZcP7RUjy5HABWLZAFo6JkKG2yunIRi8BGbsQukM09HKvUbl6J6TazBRMsasM1a8 UOXGAJbutuAe0V4vez/OOgIFKbURnwdlig9PECqx6/jSJBzQNVq/dKcf8AaTvXiWnvHn qm7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=jTVydxXiQw+Qb1VSN+iZ2d5mx1Zvm473mfJdmRZIDD8=; b=V95dfyDQ+fBJTFCy6aMqkp6tNh+XG8zd/dn9nunaaDB0s+D4IrrQvJ5OqSgWV4r1xN DEyQ9Yd0AjqcgZxBkQyuS6A+Vvawt8pZh22tCLlJ3op+nh5DAU0I3MYLtb1uY+4oF6Zj wYYtxjEFXljNM2vi7E7yIjV9ulSJnk606aVtWLDzhlek1l2KpK7NSCvVVIncPrMwQAUC 88IUp42umGB2DlJZKS+0QK0VV2GjFQ6zGr52Z6Dk+759F8Qb1r8h8ibf6xhzaFqgM28q bNmC+771Anf5cE3yuGC16vT+bUXSdKJ9wiktm3g4HmUtY/G/WxG/935P0jsoeGgzVdsT G5jg== X-Gm-Message-State: AOAM532+kpQb45ODbh3HB6qODLn8xCVEAYtUpxGcYVPxXnvvgKejqsrs UDYoj+cEyVj457ZJsli4Jlvdmrlgc8bYzQ== X-Google-Smtp-Source: ABdhPJycZe1XCyGcEAvni+ba6TNWLrVX0dfR8wuC+DwyU5QBepSBk6M62Uo/Hb1kU0gcsE2Idr1cWQ== X-Received: by 2002:a1c:f404:: with SMTP id z4mr23187959wma.39.1619885728829; Sat, 01 May 2021 09:15:28 -0700 (PDT) Received: from localhost ([93.107.145.216]) by smtp.gmail.com with ESMTPSA id a9sm6074831wrw.26.2021.05.01.09.15.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 May 2021 09:15:28 -0700 (PDT) From: "Basil L. Contovounesios" To: bug-auctex@gnu.org Subject: 13.0.11; TeX-run-format signals error in sentinel Date: Sat, 01 May 2021 17:15:26 +0100 Message-ID: <87o8dujuqp.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=contovob@tcd.ie; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) I was experimenting with configuring latexmk as best I could in TeX-command-list when I noticed an inconsistency between TeX-run-format and its sentinel. Here's a recipe to illustrate what I mean: 0. emacs -Q 1. M-x package-initialize RET 2. (progn (setq debug-on-error t) (add-hook 'LaTeX-mode-hook (lambda () (setq TeX-command-default "Latexmk"))) (with-eval-after-load 'tex (push '("Latexmk" "latexmk%(file-line-error) %(extraopts)%(mode) %t" TeX-run-format nil (latex-mode)) TeX-command-list))) 3. C-x C-e 4. C-x C-f /tmp/helloworld.tex RET 5. M-x auto-insert RET RET article RET RET RET 6. \helloworld 7. C-c C-c y RET Debugger entered--Lisp error: (wrong-type-argument stringp nil) intern(nil) TeX-TeX-sentinel-check(# "Latexmk") TeX-TeX-sentinel(# "Latexmk") TeX-command-sentinel(# "exited abnormally with code 12\n") AFAICT, this is because TeX-run-format uses TeX-TeX-sentinel, which calls TeX-TeX-sentinel-check, which expects TeX-error-report-switches to have been initialised by TeX-run-TeX, but we're not using TeX-run-TeX! I'm not sure whether the TeX-error-report-switches initialisation should be moved to TeX-run-format, or TeX-TeX-sentinel-check should guard against an uninitialised TeX-error-report-switches. Are my assumptions about or use of TeX-run-format wrong? E.g., should I just be using TeX-run-command for this purpose instead? --- Some off-topic justification for how I ended up here: I tried using a sentinel that is as close to TeX-run-TeX as possible, whilst avoiding the false positive output parsing about cross-references and the like in TeX-LaTeX-sentinel, which latexmk already handles. TeX-run-format seems to fit a nice middle-ground between TeX-run-TeX and TeX-run-command. I also tried TeX-command-run-all instead of latexmk, but AFAICT the former doesn't handle as many scenarios as the latter, such as running Biber as needed. Since neither TeX-run-format nor TeX-run-command runs TeX-after-compilation-finished-functions, I've ended up with the following custom sentinel for latexmk: (defun blc-latexmk-sentinel (proc _msg) "Run `TeX-after-compilation-finished-functions' on PROC success." (when (and (eq (process-status proc) 'exit) (zerop (process-exit-status proc))) (defvar TeX-command-buffer) (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 blc-TeX-run-latexmk (&rest args) "Like `TeX-run-format', but also run TeX compilation hooks." (let ((proc (apply #'TeX-run-format args))) (add-function :after (process-sentinel proc) #'blc-latexmk-sentinel) proc)) Please let me know if any of this runs afoul of AUCTeX's design, or if there's a better way to integrate latexmk or call a hook on successful compilation. [I read through all of the relevant AUCTeX mailing list discussions I could find, and I'm undecided about the auctex-latexmk package on MELPA, which uses old-style function advice.] Thanks, -- Basil Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2021-05-01 Package: 13.0.11 current state: ============== (setq AUCTeX-date "2021-04-28" window-system 'x LaTeX-version "2e" TeX-style-path '("~/.emacs.d/auctex" "/home/blc/.emacs.d/elpa/auctex-13.0.11.0.20210428.195438/style" "/home/blc/.emacs.d/auctex/auto" "/home/blc/.emacs.d/auctex/style" "auto" "style") TeX-auto-save nil TeX-parse-self nil TeX-master t TeX-command-list '(("Latexmk" "latexmk%(file-line-error) %(extraopts)%(mode) %t" TeX-run-format nil (latex-mode)) ("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %(output-dir) %t" TeX-run-TeX nil (plain-tex-mode ams-tex-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 (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "%(cntxcom) --once --texutil %(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 ams-tex-mode texinfo-mode context-mode) :help "Run BibTeX") ("Biber" "biber %s %(output-dir)" TeX-run-Biber nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run Biber") ("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 ams-tex-mode texinfo-mode) :help "Generate PostScript file") ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Convert DVI file to PostScript") ("Dvipdfmx" "dvipdfmx %d -o %(O?pdf)" TeX-run-dvipdfmx nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Convert DVI file to PDF with dvipdfmx") ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Convert PostScript file to PDF") ("Glossaries" "makeglossaries %(O?aux)" TeX-run-command nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run makeglossaries to create glossary\n file") ("Index" "makeindex %(O?idx)" TeX-run-index nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run makeindex to create index file") ("upMendex" "upmendex %(O?idx)" TeX-run-index t (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run upmendex to create index file") ("Xindy" "texindy %s" TeX-run-command nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run xindy to create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for common mistakes") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command")) ) From debbugs-submit-bounces@debbugs.gnu.org Wed May 05 03:55:34 2021 Received: (at 48144) by debbugs.gnu.org; 5 May 2021 07:55:34 +0000 Received: from localhost ([127.0.0.1]:58382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leCNa-0004u7-IC for submit@debbugs.gnu.org; Wed, 05 May 2021 03:55:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leCNX-0004tz-Lx for 48144@debbugs.gnu.org; Wed, 05 May 2021 03:55:33 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39771) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leCNS-0005Kr-0E; Wed, 05 May 2021 03:55:26 -0400 Received: from p5b326de1.dip0.t-ipconnect.de ([91.50.109.225]:56164 helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1leCNR-0003x8-15; Wed, 05 May 2021 03:55:25 -0400 From: Arash Esbati To: "Basil L. Contovounesios" Subject: Re: bug#48144: 13.0.11; TeX-run-format signals error in sentinel References: <87o8dujuqp.fsf@tcd.ie> Date: Wed, 05 May 2021 09:54:55 +0200 In-Reply-To: <87o8dujuqp.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sat, 01 May 2021 17:15:26 +0100") Message-ID: <86mtt9ipio.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 48144 Cc: 48144@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Basil, "Basil L. Contovounesios" writes: > I was experimenting with configuring latexmk as best I could in > TeX-command-list when I noticed an inconsistency between TeX-run-format > and its sentinel. Here's a recipe to illustrate what I mean: > > 0. emacs -Q > 1. M-x package-initialize RET > 2. (progn > (setq debug-on-error t) > (add-hook 'LaTeX-mode-hook > (lambda () (setq TeX-command-default "Latexmk"))) > (with-eval-after-load 'tex > (push '("Latexmk" > "latexmk%(file-line-error) %(extraopts)%(mode) %t" > TeX-run-format nil (latex-mode)) > TeX-command-list))) > 3. C-x C-e > 4. C-x C-f /tmp/helloworld.tex RET > 5. M-x auto-insert RET RET article RET RET RET > 6. \helloworld > 7. C-c C-c y RET > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > intern(nil) > TeX-TeX-sentinel-check(# "Latexmk") > TeX-TeX-sentinel(# "Latexmk") > TeX-command-sentinel(# "exited abnormally with code 12\n") > > AFAICT, this is because TeX-run-format uses TeX-TeX-sentinel, which > calls TeX-TeX-sentinel-check, which expects TeX-error-report-switches to > have been initialised by TeX-run-TeX, but we're not using TeX-run-TeX! > > I'm not sure whether the TeX-error-report-switches initialisation should > be moved to TeX-run-format, or TeX-TeX-sentinel-check should guard > against an uninitialised TeX-error-report-switches. > > Are my assumptions about or use of TeX-run-format wrong? E.g., should I > just be using TeX-run-command for this purpose instead? I'm not familiar with Latexmk, but I think you want to use `TeX-run-TeX' instead of `TeX-run-format'. Can you please try it with something like this: (with-eval-after-load 'tex (add-to-list 'TeX-command-list '("Latexmk" "latexmk%(file-line-error) %(extraopts)%(mode) %t" TeX-run-TeX nil (latex-mode)))) Best, Arash From debbugs-submit-bounces@debbugs.gnu.org Wed May 05 08:38:52 2021 Received: (at 48144) by debbugs.gnu.org; 5 May 2021 12:38:52 +0000 Received: from localhost ([127.0.0.1]:59905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leGnj-0002tS-SX for submit@debbugs.gnu.org; Wed, 05 May 2021 08:38:52 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:42924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1leGnf-0002tJ-Mz for 48144@debbugs.gnu.org; Wed, 05 May 2021 08:38:51 -0400 Received: by mail-wr1-f42.google.com with SMTP id l2so1653650wrm.9 for <48144@debbugs.gnu.org>; Wed, 05 May 2021 05:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=vqTspioHYbqgTD1I9oANMX4hTC3YqT3OHnGx7Rm6eBw=; b=Ka/47TiVrFoCoSDDbtZnbkDiBlMN65s6cIZshxzPu2sWX15bfpADxYm8VjUKI757Zr lDG/l3bbz0hdRA1DRoWgxYLofcdGZa+7O3TEs+hBjjG3g9bBQrz9AxiVmUA6v5I8dlv7 N+w+PZm8MrQ8ypV8Jtdl9tgIZ23oRcENuQA2DwQ5BaG5yhTPVJozisB7cmJ75MxFn7l9 LBq8Q49O7uc3X9MoEXhiKneNVpiSwoPL4oAkx7WEyMtsklMOASlLf+mYUx2Sly9bzYzL 6YFnmIFfSfZfp5RxJLbpb+VDbpAaXKsPXjBHIz5Bs9jdz3Uy+MwBQJIGsAEMTgtlFvFj isEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=vqTspioHYbqgTD1I9oANMX4hTC3YqT3OHnGx7Rm6eBw=; b=CR4qm0nwlxxLJ3OPGH1ge8hvLa8HvP4Fk2EMDFVgCV2CKUiPajtbq5wquLtGYzLC6+ F2NEzmA4/uWWvyc/MXazW0Y9L4Bsmqm/YEYgdNrjeLaOxS7yjPCyVbRjAoUtNtEWUEKB 9H1fNVWff/xh//WWykhKlS3po+0yGtUibxEKrv+C8jL+jAsK3hC416gJHQNAbeVljayt iSMMzHWDh5NeDaHsdYKxaHQsPEUSRuBNLSV1X8doP+c6TT2nw6v6V+O8CXRaJDwYfM3v b6OEoC/HyEEJ3GL35UfZ4JWUlY7kI1NpNjXsxRZGU8GMUL9QeUOhMtycj7YCn8F1VR1Q TsXg== X-Gm-Message-State: AOAM531yY5W4lO/5YCLX0xgDFTTDnQ05M8NqBYfazQz5rqAFdYO+wnkF 36XdM9Np7e4ZcYjJHXgGNuMx5JBzmA7Jdg== X-Google-Smtp-Source: ABdhPJyXhwVwvwmWs9JiuXc8ZyylE6QG/SKAfNZ5R9cxs7HuRpsD9LnSzQJ7lRDb4lfNhL8y6cwegw== X-Received: by 2002:a5d:4521:: with SMTP id j1mr31398706wra.116.1620218321803; Wed, 05 May 2021 05:38:41 -0700 (PDT) Received: from localhost ([51.37.55.64]) by smtp.gmail.com with ESMTPSA id l14sm19967801wrv.94.2021.05.05.05.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 05:38:41 -0700 (PDT) From: "Basil L. Contovounesios" To: Arash Esbati Subject: Re: bug#48144: 13.0.11; TeX-run-format signals error in sentinel References: <87o8dujuqp.fsf@tcd.ie> <86mtt9ipio.fsf@gnu.org> Date: Wed, 05 May 2021 13:38:39 +0100 In-Reply-To: <86mtt9ipio.fsf@gnu.org> (Arash Esbati's message of "Wed, 05 May 2021 09:54:55 +0200") Message-ID: <87im3xicds.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 48144 Cc: 48144@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Arash Esbati writes: > "Basil L. Contovounesios" writes: > >> I was experimenting with configuring latexmk as best I could in >> TeX-command-list when I noticed an inconsistency between TeX-run-format >> and its sentinel. Here's a recipe to illustrate what I mean: >> >> 0. emacs -Q >> 1. M-x package-initialize RET >> 2. (progn >> (setq debug-on-error t) >> (add-hook 'LaTeX-mode-hook >> (lambda () (setq TeX-command-default "Latexmk"))) >> (with-eval-after-load 'tex >> (push '("Latexmk" >> "latexmk%(file-line-error) %(extraopts)%(mode) %t" >> TeX-run-format nil (latex-mode)) >> TeX-command-list))) >> 3. C-x C-e >> 4. C-x C-f /tmp/helloworld.tex RET >> 5. M-x auto-insert RET RET article RET RET RET >> 6. \helloworld >> 7. C-c C-c y RET >> >> Debugger entered--Lisp error: (wrong-type-argument stringp nil) >> intern(nil) >> TeX-TeX-sentinel-check(# "Latexmk") >> TeX-TeX-sentinel(# "Latexmk") >> TeX-command-sentinel(# "exited abnormally with code 12\n") >> >> AFAICT, this is because TeX-run-format uses TeX-TeX-sentinel, which >> calls TeX-TeX-sentinel-check, which expects TeX-error-report-switches to >> have been initialised by TeX-run-TeX, but we're not using TeX-run-TeX! >> >> I'm not sure whether the TeX-error-report-switches initialisation should >> be moved to TeX-run-format, or TeX-TeX-sentinel-check should guard >> against an uninitialised TeX-error-report-switches. >> >> Are my assumptions about or use of TeX-run-format wrong? E.g., should I >> just be using TeX-run-command for this purpose instead? > > I'm not familiar with Latexmk, but I think you want to use `TeX-run-TeX' > instead of `TeX-run-format'. Can you please try it with something like > this: > > (with-eval-after-load 'tex > (add-to-list 'TeX-command-list > '("Latexmk" > "latexmk%(file-line-error) %(extraopts)%(mode) %t" > TeX-run-TeX nil (latex-mode)))) Thanks for the suggestion, but this doesn't address the OP. Ideally TeX-run-TeX would indeed be the most appropriate function, but it is not practical with latexmk because the sentinel of TeX-run-TeX unconditionally picks up all the errors and warnings from all the runs that latexmk invokes, rather than just from the last (successful) run. This means that TeX-run-TeX never sets the next command to "View". TeX-run-TeX also does not recognise the output of latexmk when there is nothing to do for the current file. The bug report is about the inconsistency between TeX-run-format and its sentinel TeX-TeX-sentinel. In some cases the latter expects TeX-error-report-switches to be initialised, but TeX-run-format never does this. IMO if TeX-TeX-sentinel is going to be used with TeX-run-format then it should not assume that its process was started by TeX-run-TeX. Unless I'm missing something? [ BTW since submitting the OP I have indeed resorted to using the auctex-latexmk package, which seems to work reliably well. ] Thanks, -- Basil From debbugs-submit-bounces@debbugs.gnu.org Thu May 06 07:33:19 2021 Received: (at 48144) by debbugs.gnu.org; 6 May 2021 11:33:19 +0000 Received: from localhost ([127.0.0.1]:37437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lecFq-0001MH-RJ for submit@debbugs.gnu.org; Thu, 06 May 2021 07:33:19 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:42978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lecFo-0001MB-KE for 48144@debbugs.gnu.org; Thu, 06 May 2021 07:33:18 -0400 Received: from localhost (42-146-77-152.rev.home.ne.jp [42.146.77.152]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 4874F246; Thu, 6 May 2021 20:33:14 +0900 (JST) From: Ikumi Keita To: "Basil L. Contovounesios" Subject: Re: bug#48144: 13.0.11; TeX-run-format signals error in sentinel In-reply-to: <87im3xicds.fsf@tcd.ie> References: <87o8dujuqp.fsf@tcd.ie> <86mtt9ipio.fsf@gnu.org> <87im3xicds.fsf@tcd.ie> Comments: In-reply-to "Basil L. Contovounesios" message dated "Wed, 05 May 2021 13:38:39 +0100." X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 27.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Thu, 06 May 2021 20:33:10 +0900 Message-ID: <27577.1620300790@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 48144 Cc: Arash Esbati , 48144@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi Basil, thanks for your report. >>>>> "Basil L. Contovounesios" writes: >>> AFAICT, this is because TeX-run-format uses TeX-TeX-sentinel, which >>> calls TeX-TeX-sentinel-check, which expects TeX-error-report-switches to >>> have been initialised by TeX-run-TeX, but we're not using TeX-run-TeX! I agree with your analysis. I made a tentative fix as attachment, which moves initialization of `TeX-error-report-switches' into `TeX-format-run'. Could you test whether it works on your side? > The bug report is about the inconsistency between TeX-run-format and its > sentinel TeX-TeX-sentinel. In some cases the latter expects > TeX-error-report-switches to be initialised, but TeX-run-format never > does this. IMO if TeX-TeX-sentinel is going to be used with > TeX-run-format then it should not assume that its process was started by > TeX-run-TeX. Unless I'm missing something? I think this is a AUCTeX bug. `TeX-run-format' is a valid choice for "How" item of `TeX-command-list' according to its defcustom. However, current implementation of `TeX-run-format' doesn't achieve its job as your analysis shows. >>> I'm not sure whether the TeX-error-report-switches initialisation should >>> be moved to TeX-run-format, or TeX-TeX-sentinel-check should guard >>> against an uninitialised TeX-error-report-switches. Actually, it isn't clear, at least for me, which is the proper fix. :-) It's very difficult to determine what the proper behavior of `TeX-run-format' and `TeX-run-TeX' should be, from the relevant doc stirngs: ,---- | (defun TeX-run-format (name command file) | "Create a process for NAME using COMMAND to format FILE with TeX." `---- ,---- | (defun TeX-run-TeX (name command file) | "Create a process for NAME using COMMAND to format FILE with TeX." `---- ,---- | (defcustom TeX-command-list | [...] | TeX-run-format: As `TeX-run-command', but assume the output is created | by a TeX macro package. Return the process object. | | TeX-run-TeX: For TeX output. `---- Actually (again), not all the TeX-run-* series are maintained well. The ones which are seldom used sometimes have nonsense implementation: https://lists.gnu.org/archive/html/auctex-devel/2017-05/msg00014.html Regards, Ikumi Keita --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=diff Content-Description: Fix TeX-run-format diff --git a/tex-buf.el b/tex-buf.el index 114ceac4..4dd200e3 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -1124,42 +1124,28 @@ Return the new process." lst nil) (setq lst (cdr lst)))))) -(defun TeX-run-format (name command file) - "Create a process for NAME using COMMAND to format FILE with TeX." - (TeX-run-set-command name command) - (let ((buffer (TeX-process-buffer-name file)) - (process (TeX-run-command name command file))) - ;; Hook to TeX debugger. - (with-current-buffer buffer - (TeX-parse-reset) - (setq TeX-parse-function #'TeX-parse-TeX) - (setq TeX-sentinel-function #'TeX-TeX-sentinel) - (if TeX-process-asynchronous - (progn - ;; Updating the mode line. - (setq TeX-current-page "[0]") - (TeX-format-mode-line process) - (set-process-filter process #'TeX-format-filter))) - process))) - (defvar TeX-error-report-switches nil "Reports presence of errors after `TeX-run-TeX'. +Actually, `TeX-run-format' sets it. To test whether the current buffer has a compile error from last -run of `TeX-run-TeX', use +run of `TeX-run-format', use (TeX-error-report-has-errors-p)") (defun TeX-error-report-has-errors-p () "Return non-nil if current buffer has compile errors from last TeX run." (plist-get TeX-error-report-switches (intern (TeX-master-file)))) -(defun TeX-run-TeX (name command file) +(defun TeX-run-format (name command file) "Create a process for NAME using COMMAND to format FILE with TeX." + (TeX-run-set-command name command) + (let ((buffer (TeX-process-buffer-name file)) + (process (TeX-run-command name command file)) + (current-master (TeX-master-file))) + + ;; Save information in TeX-error-report-switches + ;; Initialize error to nil (no error) for current master. + ;; Presence of error is reported inside `TeX-TeX-sentinel-check' - ;; Save information in TeX-error-report-switches - ;; Initialize error to nil (no error) for current master. - ;; Presence of error is reported inside `TeX-TeX-sentinel-check' - (let ((current-master (TeX-master-file)) - (idx-file nil) (element nil)) ;; the current master file is saved because error routines are ;; parsed in other buffers; (setq TeX-error-report-switches @@ -1170,6 +1156,23 @@ run of `TeX-run-TeX', use (plist-put TeX-error-report-switches (intern current-master) nil)) + ;; Hook to TeX debugger. + (with-current-buffer buffer + (TeX-parse-reset) + (setq TeX-parse-function #'TeX-parse-TeX) + (setq TeX-sentinel-function #'TeX-TeX-sentinel) + (if TeX-process-asynchronous + (progn + ;; Updating the mode line. + (setq TeX-current-page "[0]") + (TeX-format-mode-line process) + (set-process-filter process #'TeX-format-filter))) + process))) + +(defun TeX-run-TeX (name command file) + "Create a process for NAME using COMMAND to format FILE with TeX." + + (let ((idx-file nil) (element nil)) ;; Store md5 hash of the index file before running LaTeX. (and (memq major-mode '(doctex-mode latex-mode)) (prog1 (file-exists-p --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 06 08:09:32 2021 Received: (at 48144) by debbugs.gnu.org; 6 May 2021 12:09:32 +0000 Received: from localhost ([127.0.0.1]:37484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lecou-0003vX-3D for submit@debbugs.gnu.org; Thu, 06 May 2021 08:09:32 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:41789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lecor-0003vB-5t for 48144@debbugs.gnu.org; Thu, 06 May 2021 08:09:31 -0400 Received: by mail-wr1-f45.google.com with SMTP id d11so5346459wrw.8 for <48144@debbugs.gnu.org>; Thu, 06 May 2021 05:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=NcnlN1Nfl8+XvPK0Sr8BEyzSTi2vhNH5kA7ZMZn+WAU=; b=D6Z2yoWPENqBv2g1SAoj2g35pj5gve8umSFrSndOGw2gXmjTxAfP+tp7N1WqMF3asG StCFODfQkBLAjsVIhgsH4igNiBbxuvW71IVcREZvyOKdPVKMxvx61tTquUth0J6ipFPv svDbDk0SqIxcer2+afZsczE8PKPdNN+sLq/XkqQnytx4I0IihgjgESWosmCaWzU1MklT A5xiGS+RcrEi5fUPGBvkQ3hKEO7KSWC4onrrvz1fCZJ4G73YbHJ8ZErXxiFbh7IUw2e8 BSz7cAHIvfD4dMtqm/F1ix8q/2dtw7C+30yLsJl6aL7UxMPAUcrs69EgYL63JeNyUty7 Rqfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NcnlN1Nfl8+XvPK0Sr8BEyzSTi2vhNH5kA7ZMZn+WAU=; b=qacESMszZxEf1raLhQ/cjPDzM6i1Ta1vVenZVcV3L6FCbP3vn6vDIByDsXkukJ4Orz NMvbxf2MDGXKYrLalj96n+ukla0shzPMY0BUYba5I6Ot1XQIjArYPnWJcOZSgfYeK1Bv Eg7eXSYFGbVObjk4DX/iHpNepJToJWLRd3ZOULAa0CSplQH4D+QCBvYcSQfamwqjv4o7 jrvVFbIml52vVy8myBbk/U8ZHnFf6xbn2E5wAcqiTDSFugsHq3lDnYd02bWWUwRPaUeG EqoCUU9Cbt1G8fyqP271FiAN8ySM5VfM1PcEWwOypKtuWGlauVuzPU8UUbL5IFcTS/2h +NGg== X-Gm-Message-State: AOAM530KTNEhbI2JUdF/Er13jL2P4fAq45kATYGrH7V7H2o21FXftk2U qTAoUHIYqadfKWv6ihUmrDqCvg== X-Google-Smtp-Source: ABdhPJzuZyi1d5XG90NVl2HIePUp67UmS9BBtzOwDo4swWj0K/Ix/gpVrQS/x9AWyhDAaM9uFWTkUg== X-Received: by 2002:a5d:610a:: with SMTP id v10mr4576389wrt.399.1620302963369; Thu, 06 May 2021 05:09:23 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:d15:339e:aa10:60f1]) by smtp.gmail.com with ESMTPSA id y21sm9964881wmi.15.2021.05.06.05.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 May 2021 05:09:22 -0700 (PDT) From: "Basil L. Contovounesios" To: Ikumi Keita Subject: Re: bug#48144: 13.0.11; TeX-run-format signals error in sentinel References: <87o8dujuqp.fsf@tcd.ie> <86mtt9ipio.fsf@gnu.org> <87im3xicds.fsf@tcd.ie> <27577.1620300790@localhost> Date: Thu, 06 May 2021 13:09:21 +0100 In-Reply-To: <27577.1620300790@localhost> (Ikumi Keita's message of "Thu, 06 May 2021 20:33:10 +0900") Message-ID: <87tungm5ce.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 48144 Cc: Arash Esbati , 48144@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 48144 + patch quit Ikumi Keita writes: > I agree with your analysis. I made a tentative fix as attachment, which > moves initialization of `TeX-error-report-switches' into > `TeX-format-run'. Could you test whether it works on your side? It works well here, thank you! > Actually (again), not all the TeX-run-* series are maintained well. The > ones which are seldom used sometimes have nonsense implementation: > https://lists.gnu.org/archive/html/auctex-devel/2017-05/msg00014.html :) -- Basil From debbugs-submit-bounces@debbugs.gnu.org Thu May 06 09:03:25 2021 Received: (at 48144) by debbugs.gnu.org; 6 May 2021 13:03:25 +0000 Received: from localhost ([127.0.0.1]:37515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ledf3-0006c6-3K for submit@debbugs.gnu.org; Thu, 06 May 2021 09:03:25 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:43120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ledf0-0006c0-Uz for 48144@debbugs.gnu.org; Thu, 06 May 2021 09:03:24 -0400 Received: from localhost (42-146-77-152.rev.home.ne.jp [42.146.77.152]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 0C9AB246; Thu, 6 May 2021 22:03:21 +0900 (JST) From: Ikumi Keita To: "Basil L. Contovounesios" Subject: Re: bug#48144: 13.0.11; TeX-run-format signals error in sentinel In-reply-to: <87tungm5ce.fsf@tcd.ie> References: <87o8dujuqp.fsf@tcd.ie> <86mtt9ipio.fsf@gnu.org> <87im3xicds.fsf@tcd.ie> <27577.1620300790@localhost> <87tungm5ce.fsf@tcd.ie> Comments: In-reply-to "Basil L. Contovounesios" message dated "Thu, 06 May 2021 13:09:21 +0100." X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 27.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29514.1620306197.1@localhost> Date: Thu, 06 May 2021 22:03:17 +0900 Message-ID: <29515.1620306197@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 48144 Cc: Arash Esbati , 48144@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> "Basil L. Contovounesios" writes: >> I agree with your analysis. I made a tentative fix as attachment, which >> moves initialization of `TeX-error-report-switches' into >> `TeX-format-run'. Could you test whether it works on your side? > It works well here, thank you! Thanks for confirmation, pushed to the git repo. Bye, Ikumi Keita From debbugs-submit-bounces@debbugs.gnu.org Thu May 06 09:04:12 2021 Received: (at control) by debbugs.gnu.org; 6 May 2021 13:04:12 +0000 Received: from localhost ([127.0.0.1]:37519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ledfo-0006ct-C3 for submit@debbugs.gnu.org; Thu, 06 May 2021 09:04:12 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:43126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ledfm-0006cn-Gm for control@debbugs.gnu.org; Thu, 06 May 2021 09:04:10 -0400 Received: from localhost (42-146-77-152.rev.home.ne.jp [42.146.77.152]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id BC135246 for ; Thu, 6 May 2021 22:04:09 +0900 (JST) To: control@debbugs.gnu.org From: Ikumi Keita Subject: control message for bug #48144 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29519.1620306246.1@localhost> Date: Thu, 06 May 2021 22:04:06 +0900 Message-ID: <29520.1620306246@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 48144 fixed close 48144 quit From unknown Wed Jun 18 00:25:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 04 Jun 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator