From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SNNsDm4O4mOIKQAAbAwnHQ (envelope-from ) for ; Tue, 07 Feb 2023 09:40:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id +LSVDW4O4mPYKAEAG6o9tA (envelope-from ) for ; Tue, 07 Feb 2023 09:40:14 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E8492B8A1 for ; Tue, 7 Feb 2023 09:40:13 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPJVk-0005ML-8v; Tue, 07 Feb 2023 03:39:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPJVg-00055b-On for emacs-orgmode@gnu.org; Tue, 07 Feb 2023 03:39:29 -0500 Received: from pv50p00im-ztdg10011901.me.com ([17.58.6.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPJVf-0002bH-4J for emacs-orgmode@gnu.org; Tue, 07 Feb 2023 03:39:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1675759164; bh=xYczMjgfxg3gF59deTUVc9zZ6yUz8FzJhqFWvPDxpPw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cWLAL97rDjyRR2jpRb6IBQojwWgIcoIq4xm6QlKJldMRcRUG+B+9P0BCURh9DEX+C AuHmo73qHoTTiY6Y8mSxO2MFSLxFqcKvaJEJeNEvNhEwgf/xgKS2TbEAYOaHq/wJeC MPyN7cjsbEco/3qUupynzOYZl5Xno3SesdH4jT1+J5/pP+biQMpwrYbwtCIQtkgIHz CpQG1Rowatr9rswNv22ynjWA22/DAawqyRlMXime/JLrsorR43w1zl7onm2xBAJ5Gk VvshMvQNbR6YpcAxuYP9pPUYHE4swGDD2ez/tLnyxsfe45f956uvV/srn2LCnZPi1w rv1VTEXx9YwdQ== Received: from Rudolfs-MacBook-Air.local (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10011901.me.com (Postfix) with ESMTPSA id 946933A02FA; Tue, 7 Feb 2023 08:39:22 +0000 (UTC) From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= To: Max Nikulin , emacs-orgmode@gnu.org Subject: Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code In-Reply-To: References: <20230206214216.64841-1-salutis@me.com> Date: Tue, 07 Feb 2023 09:39:18 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Proofpoint-GUID: Fz4aQqP3lilFwdtI9XJxlatwqt0JJpFO X-Proofpoint-ORIG-GUID: Fz4aQqP3lilFwdtI9XJxlatwqt0JJpFO X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.572,17.0.605.474.0000000_definitions?= =?UTF-8?Q?=3D2020-02-14=5F11:2020-02-14=5F02,2020-02-14=5F11,2020-01-23?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2302070077 Received-SPF: pass client-ip=17.58.6.50; envelope-from=salutis@me.com; helo=pv50p00im-ztdg10011901.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=me.com header.s=1a1hai header.b=cWLAL97r; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=me.com (policy=quarantine) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675759214; a=rsa-sha256; cv=none; b=ZJnPc0kYBi3UrYruIgAO43a2pVQm5t9fh93AfdjGL469A6bqnxAPTLSwPNmaqXEjtP8Z5H dsDOZLnHY0kAbAjUBREZ0PmlTUHQY1/jUqD6rUgCTxpk+TiLy626LbNxeVjASsAEVFQwB2 miWGDMQWlmGNa5dWvz2yLOcCCYSuzEfxO9AHIacNZDEkX2Aspm3N9FUfHSpqwTLuccvI42 AY3S5X6J1SCWbN4SZQKHwKinobRsimv5+grgQ0vyuzus3En6FO2FXw6mlnm/ToczbFqYyG NMw7kjs/egyz0We8ECiHuUlf4DbWPFvNy+1MiTtfEXAHuS3zrjmtTMB6XJ37Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675759214; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=aGXl1vb6q/LtI2lr07nFcU5nFwa5kbWvKpYyPS3a/1M=; b=ha5II3grEzMP+6UcRKHSbu9K9om2UIjj6WvLKPyJ3DLExVyxFtZHVJXNLrp2MSx+eq7krz BNu5e2X4zCpJwCvopkqLl32blEXDoXcnPanSS+vI+IdseJFjWNqLu0HxfxD1j0/lxWYDWK BCf3JCggtvN0DaUup4Ja5yQ16WfMX8j/Ll4UHcer+GmcdnE2vm0WHpiRK9WvVTfu+llbVp 2v2oMkig+YoNf3YkpzBQ0JLH/CLXmvkMbg6hUGeokSSmUeLhxAYgxmQ0sRWrJdAfwRwFWQ gJv8AkjPiogbwekwWrPUgPoGT8e5A0u4BSL3M4A1+1OmESNeu2neBS03ElHSAA== X-Migadu-Queue-Id: E8492B8A1 X-Migadu-Spam: Yes X-Spam: Yes X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=me.com header.s=1a1hai header.b=cWLAL97r; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=me.com (policy=quarantine) X-Migadu-Spam-Score: 6.00 X-Spam-Score: 6.00 X-TUID: 3oBHJ8v+to8b --=-=-= Content-Type: text/plain Max Nikulin writes: > Should not the format argument be corrected to have valid @displaymath > snippet instead? Thank you, Max! See, this happens when I write code 10 minutes before going to bed: incorrect code and no tests, both equally bad. Please see the attached patch. Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-texinfo-Fix-invalid-syntax-in-Texinfo-version-det.patch >From ce1062dbda870346b18ae35c28e9cc034c0de548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Mon, 6 Feb 2023 22:33:40 +0100 Subject: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code * lisp/ox-texinfo.el (org-texinfo-supports-math-p): Fix the incorrect syntax @displaymath{1 + 1 = 2} used to detect whether Texinfo supports TeX "math mode". Instead, use the correct syntax @math{1 + 1 = 2}. --- lisp/ox-texinfo.el | 14 ++++++++------ testing/lisp/test-ox-texinfo.el | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 8e3a04562..56564a5c5 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -2025,12 +2025,14 @@ Once computed, the results remain cached." (unless (boundp 'org-texinfo-supports-math--cache) (setq org-texinfo-supports-math--cache (let ((math-example "1 + 1 = 2")) - (let* ((input-file - (make-temp-file "test" nil ".info")) - (input-content - (concat (format "@setfilename %s" input-file) "\n" - "@node Top" "\n" - (format "@displaymath{%s}" math-example) "\n"))) + (let* ((input-file (make-temp-file "test" nil ".info")) + (input-content (string-join + (list (format "@setfilename %s" input-file) + "@node Top" + "@displaymath" + math-example + "@end displaymath") + "\n"))) (with-temp-file input-file (insert input-content)) (let* ((output-file (org-texinfo-compile input-file)) diff --git a/testing/lisp/test-ox-texinfo.el b/testing/lisp/test-ox-texinfo.el index 51fdb3606..4bb902988 100644 --- a/testing/lisp/test-ox-texinfo.el +++ b/testing/lisp/test-ox-texinfo.el @@ -292,5 +292,35 @@ nil '(:with-latex t)))))) + +;;; End-to-end + +(ert-deftest test-ox-texinfo/end-to-end-inline () + "Test end-to-end with inline TeX fragment." + (should + (org-test-with-temp-text + "$a^2 = b$" + (let ((export-buffer "*Test Texinfo Export*") + (org-export-show-temporary-export-buffer nil)) + (org-export-to-buffer 'texinfo export-buffer + nil nil nil nil nil + #'texinfo-mode))))) + +(ert-deftest test-ox-texinfo/end-to-end-sanity-check-displayed () + "Test end-to-end with LaTeX environment." + (should + (org-test-with-temp-text + (string-join + (list "\\begin{equation}" + "a ^ 2 = b" + "b ^ 2 = c" + "\\end{equation}") + "\n") + (let ((export-buffer "*Test Texinfo Export*") + (org-export-show-temporary-export-buffer nil)) + (org-export-to-buffer 'texinfo export-buffer + nil nil nil nil nil + #'texinfo-mode))))) + (provide 'test-ox-texinfo) ;;; test-ox-texinfo.el end here -- 2.39.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 "Strange as it may sound, the power of mathematics rests on its evasion of all unnecessary thought and on its wonderful saving of mental operations." -- Ernst Mach, 1838-1916 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--