From: Leo Butler <Leo.Butler@umanitoba.ca>
To: Ihor Radchenko <yantar92@posteo.net>,
"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Cc: Benjamin McMillan <mcmillanbb@gmail.com>
Subject: [PATCH] Re: [BUG] ob-maxima outputs linenum:0 in results on MacOS
Date: Fri, 20 Dec 2024 20:40:42 +0000 [thread overview]
Message-ID: <87ikre6qba.fsf_-_@t14.reltub.ca> (raw)
In-Reply-To: <CALo8A5WbQWO0wOCwe+h0_i2-34WUo16t_aZ=dKHF+11=ox6Oqg@mail.gmail.com> (Benjamin McMillan's message of "Thu, 19 Dec 2024 21:47:33 +1300")
[-- Attachment #1: Type: text/plain, Size: 149 bytes --]
Ihor,
Please find attached the amended patch. All things considered, I think
this is the best option to fix the issue that has arisen.
Leo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ob-maxima.el-fix-Mac-related-bug.patch --]
[-- Type: text/x-diff; name="0001-lisp-ob-maxima.el-fix-Mac-related-bug.patch", Size: 1598 bytes --]
From db509cf4b81f78a5c85cf12c7f7b2879f2a47397 Mon Sep 17 00:00:00 2001
From: Leo Butler <leo.butler@umanitoba.ca>
Date: Sun, 15 Dec 2024 21:20:26 -0600
Subject: [PATCH] lisp/ob-maxima.el: fix Mac-related bug
* ob-maxima.el (org-babel-maxima--output-filter-regexps): Filter out
lines that end with the literal string "(linenum:0,". Benjamin
McMillan reports that, on his Mac, this string is appearing in the
Maxima output. Maxima is echoing part of the command-line arguments
passed to it (but it should not), which appears to be a Mac-specific
problem. Benjamin reports that the additional regexp removes the
errant strings and that all tests are passed.
Reported-By: Benjamin McMillan
Link: https://list.orgmode.org/87plm2e50v.fsf@localhost/
---
lisp/ob-maxima.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index afd615f8d..35438a880 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -110,7 +110,8 @@ output. See `org-babel-maxima-expand'.")
"\n")))
(defvar org-babel-maxima--output-filter-regexps
- '("batch" ;; remove the `batch' or `batchload' line
+ '("(linenum:0,$" ;; remove fragment from command-line (see `org-babel-execute:maxima')
+ "batch" ;; remove the `batch' or `batchload' line
"^rat: replaced .*$" ;; remove notices from `rat'
"^;;; Loading #P" ;; remove notices from the lisp implementation
"^read and interpret" ;; remove notice from `batch'
--
2.45.2
[-- Attachment #3: ATT00001.txt --]
[-- Type: text/plain, Size: 1835 bytes --]
On Thu, Dec 19 2024, Benjamin McMillan <mcmillanbb@gmail.com> wrote:
> The modified suggestion:
> (add-to-list 'org-babel-maxima--output-filter-regexps "(linenum:0,$")
> also fixes the problem in the cases that I checked.
>
> Benjamin
>
> On Wed, Dec 18, 2024 at 10:06â¯AM Leo Butler <Leo.Butler@umanitoba.ca> wrote:
>
>> On Tue, Dec 17 2024, Ihor Radchenko <yantar92@posteo.net> wrote:
>>
>> > Leo Butler <Leo.Butler@umanitoba.ca> writes:
>> >
>> >> Putting that into the batch file will result in it appearing in the
>> >> output of the source-code block. We are trying to stop that.
>> >
>> > FYI, I have basically no experience with Maxima. So, I was simply
>> > shooting in the dark. AFAIU, linenum:0 simply sets variable value. If
>> > setting a value can be done from inside a script...
>>
>> To explain, Maxima keeps track of the "line numbers" of each complete
>> input in the variable linenum. When it executes the batch script that
>> Org sends it, that command is on line 1, so line numbering in the script
>> would begin at 2. We set linenum to 0 so that the line numbering in the
>> script starts at 1.
>>
>> >
>> >> I think, if the above regexp works for Benjamin, then we should use
>> >> it. The regexp only matches an incomplete (hence mal-formed) line of
>> >> input, and so it can only match the errant output that Benjamin is
>> >> seeing.
>> >
>> > Unless we find a better solution, I have no problem with it. It is just
>> > that regexp filtering can cause issues, like what we keep seeing again
>> > and again with prompt filtering in ob-shell.
>>
>> Agreed. One alternative would be to have Maxima add a command-line
>> option that re-starts line-numbering in a batch file at line 1. That
>> would not fix Benjamin's problem, in the short term, though.
>>
>> Leo
prev parent reply other threads:[~2024-12-20 20:41 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-01 4:35 [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)] Benjamin McMillan
2024-09-10 17:01 ` Ihor Radchenko
2024-09-16 14:27 ` Benjamin McMillan
2024-09-17 12:29 ` Benjamin McMillan
2024-09-17 18:44 ` Ihor Radchenko
[not found] ` <CALo8A5Vm-gik0qQC7KacNg7kN2VzL0Y1e8_LXxV8S7-we9CYSw@mail.gmail.com>
2024-09-22 9:53 ` Ihor Radchenko
2024-09-23 13:17 ` Benjamin McMillan
2024-11-03 18:00 ` Ihor Radchenko
2024-11-04 12:58 ` Benjamin McMillan
2024-11-04 20:13 ` Ihor Radchenko
2024-11-05 1:00 ` Benjamin McMillan
2024-11-09 14:55 ` Ihor Radchenko
2024-11-10 13:26 ` Benjamin McMillan
2024-11-12 19:12 ` Ihor Radchenko
2024-11-14 5:59 ` Benjamin McMillan
2024-11-23 19:15 ` Ihor Radchenko
2024-11-24 6:02 ` Benjamin McMillan
2024-12-08 12:24 ` [BUG] ob-maxima outputs linenum:0 in results on MacOS (was: [BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]) Ihor Radchenko
2024-12-09 15:11 ` [BUG] ob-maxima outputs linenum:0 in results on MacOS Leo Butler
2024-12-09 20:17 ` Leo Butler
2024-12-10 8:58 ` Benjamin McMillan
2024-12-10 18:02 ` Leo Butler
2024-12-12 20:27 ` Benjamin McMillan
2024-12-14 23:11 ` Leo Butler
2024-12-15 8:43 ` Benjamin McMillan
2024-12-16 3:32 ` Leo Butler
2024-12-16 17:44 ` Ihor Radchenko
2024-12-17 3:13 ` Leo Butler
2024-12-17 17:36 ` Ihor Radchenko
2024-12-17 21:06 ` Leo Butler
2024-12-19 8:47 ` Benjamin McMillan
2024-12-20 20:40 ` Leo Butler [this message]
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=87ikre6qba.fsf_-_@t14.reltub.ca \
--to=leo.butler@umanitoba.ca \
--cc=emacs-orgmode@gnu.org \
--cc=mcmillanbb@gmail.com \
--cc=yantar92@posteo.net \
/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).