emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <rudolf@adamkovic.org>
To: emacs-orgmode@gnu.org
Subject: Improve Texinfo math checking
Date: Tue, 27 Aug 2024 11:34:37 +0200	[thread overview]
Message-ID: <m2r0aaxqaa.fsf@adamkovic.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Hello there!

The attached patch improves how the Texinfo exporter checks if Texinfo
supports `@math'.  Please review and merge.

Rudy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-texinfo-Check-for-math-support-without-warnings-a.patch --]
[-- Type: text/x-patch, Size: 2174 bytes --]

From 49065a3d39dba83669e123297bf87ce76cba38d4 Mon Sep 17 00:00:00 2001
From: Rudolf Adamkovic <rudolf@adamkovic.org>
Date: Tue, 27 Aug 2024 11:10:56 +0200
Subject: [PATCH] ox-texinfo: Check for math support without warnings and
 quietly

* lisp/ox-texinfo.el (org-texinfo-supports-math-p): Two
improvements: (1) Fix the incorrect `.info' extension used for the
temporary `.texi' file.  This removes the warning "makeinfo: warning:
input file testXXX.info; did you mean testXXX.texi?" (2) Suppress
output when compiling the "Is math supported?" test file.  This is to
avoid user confusion, as the user cares about their Texinfo file, not
implementation details.  This removes the message "Processing Texinfo
file /var/.../testXXX.info...".
---
 lisp/ox-texinfo.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 6adee9fca..149ab944f 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -2037,7 +2037,7 @@ 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"))
+            (let* ((input-file (make-temp-file "test" nil ".texi"))
                    (input-content (string-join
                                    (list (format "@setfilename %s" input-file)
                                          "@node Top"
@@ -2050,7 +2050,8 @@ Once computed, the results remain cached."
               (when-let* ((output-file
                            ;; If compilation fails, consider math to
                            ;; be not supported.
-                           (ignore-errors (org-texinfo-compile input-file)))
+                           (ignore-errors (let ((inhibit-message t))
+                                            (org-texinfo-compile input-file))))
                           (output-content (with-temp-buffer
                                             (insert-file-contents output-file)
                                             (buffer-string))))
-- 
2.39.3 (Apple Git-146)


[-- Attachment #3: Type: text/plain, Size: 229 bytes --]

-- 
"One can begin to reason only when a clear picture has been formed in
the imagination."  --- Walter Warwick Sawyer, Mathematician's Delight,
1943

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org

             reply	other threads:[~2024-08-27  9:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  9:34 Rudolf Adamkovič [this message]
2024-08-27  9:41 ` [PATCH] Texinfo: Check for math support without warnings and quietly (was: Improve Texinfo math checking) Rudolf Adamkovič
2024-09-01 10:08   ` Rudolf Adamkovič
2024-09-16 21:11     ` Rudolf Adamkovič
2024-09-22 16:16     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r0aaxqaa.fsf@adamkovic.org \
    --to=rudolf@adamkovic.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).