[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection
From: |
Rudolf Adamkovič |
Subject: |
Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code |
Date: |
Wed, 15 Feb 2023 19:22:49 +0100 |
Max Nikulin <manikulin@gmail.com> writes:
> Since content of subr-x.el consists of `defsubst' definitions, likely it
> is preferable to use
>
> (eval-when-compile (require 'subr-x))
All right, I added the 'require' to both files. Better?
Rudy
>From 384515548a4eb790e9b947e484dd9da41bdece94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
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 | 16 ++++++++++------
testing/lisp/test-ox-texinfo.el | 32 ++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 8e3a04562..4ff482cc3 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -32,6 +32,8 @@
(require 'cl-lib)
(require 'ox)
+(eval-when-compile (require 'subr-x))
+
(defvar orgtbl-exp-regexp)
(defvar org-texinfo-supports-math--cache)
@@ -2025,12 +2027,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..38395500d 100644
--- a/testing/lisp/test-ox-texinfo.el
+++ b/testing/lisp/test-ox-texinfo.el
@@ -24,6 +24,8 @@
(require 'cl-lib)
(require 'ox-texinfo)
+(eval-when-compile (require 'subr-x))
+
(unless (featurep 'ox-texinfo)
(signal 'missing-test-dependency "org-export-texinfo"))
@@ -292,5 +294,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
--
"Chop your own wood and it will warm you twice."
-- Henry Ford; Francis Kinloch, 1819; Henry David Thoreau, 1854
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
- [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Rudolf Adamkovič, 2023/02/06
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Max Nikulin, 2023/02/06
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Rudolf Adamkovič, 2023/02/07
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Max Nikulin, 2023/02/07
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Ihor Radchenko, 2023/02/07
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Max Nikulin, 2023/02/07
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code,
Rudolf Adamkovič <=
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Ihor Radchenko, 2023/02/17
- Re: [PATCH] ox-texinfo: Fix invalid syntax in Texinfo version detection code, Ihor Radchenko, 2023/02/17