On Thu, Nov 03 2022, Max Nikulin <maniku...@gmail.com> wrote:

> On 03/11/2022 17:01, Fraga, Eric wrote:
>> On Thursday,  3 Nov 2022 at 09:35, Max Nikulin wrote:
>>> maxima --very-quiet -r "batchload(\"c:\\Temp\\maxima-XXXXXX.max\")"$
>> Should the $ not be within the quotes?
>
> Does "$" have any special meaning in cmd.exe? I do not mind that it
> should be inside `format' first argument.
>
> I do not have a Windows machine to test and not motivated enough to
> try Emacs in wine.

Max, a minor modification of the test you sent earlier shows that when
system-type is ms-dos, the placement does not matter (the command-line
is the same); but for gnu/linux, placement matters and Eric is right
(the command-lines are not the same and the dollar sign needs to be
escaped).

I have attached a patch that puts the dollar sign in the right place for
both. The existing tests pass when running 'make test'.

Leo

From 423340175a354463c82fac2b4b3a404391e67eb5 Mon Sep 17 00:00:00 2001
From: Leo Butler <leo.but...@umanitoba.ca>
Date: Thu, 3 Nov 2022 10:39:28 -0500
Subject: [PATCH] lisp/ob-maxima.el: correct placement of $ in command string

* ob-maxima.el (org-babel-maxima:execute): Commit 6156b57bdf2b fixed a
quoting problem encountered on windows. However, the dollar sign ($)
is part of the maxima command string and needs to be escaped on
gnu/linux.

Reported by: Eric Fraga
Ref:
https://list.orgmode.org/950eb41c-1c8a-c891-af8d-276f6a452...@electrum-bikes.pl/T/#m4b5a54551604e5b3ec21f317c4a31b547ccada68

TINYCHANGE
---
 lisp/ob-maxima.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index dba12d7b6..e3dfbb668 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -81,10 +81,10 @@ This function is called by `org-babel-execute-src-block'."
 	(result
 	 (let* ((cmdline (or (cdr (assq :cmdline params)) ""))
 		(in-file (org-babel-temp-file "maxima-" ".max"))
-		(cmd (format "%s --very-quiet -r %s$ %s"
+		(cmd (format "%s --very-quiet -r %s %s"
 			     org-babel-maxima-command
                              (shell-quote-argument
-                              (format "batchload(%S)" in-file))
+                              (format "batchload(%S)$" in-file))
                              cmdline)))
 	   (with-temp-file in-file (insert (org-babel-maxima-expand body params)))
 	   (message cmd)
-- 
2.35.1

Reply via email to