emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [O] Maxima code blocks does not work in windows revisited
@ 2022-10-31 22:00 ELECTRUM BIKES
  0 siblings, 0 replies; 20+ messages in thread
From: ELECTRUM BIKES @ 2022-10-31 22:00 UTC (permalink / raw)
  To: emacs-orgmode

I tried replacing it and doesn't work, still the same error, win10 emacs 
28.1



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [O] Maxima code blocks does not work in windows revisited
@ 2022-11-01  7:45 Mati
  2022-11-01  8:04 ` Ihor Radchenko
  0 siblings, 1 reply; 20+ messages in thread
From: Mati @ 2022-11-01  7:45 UTC (permalink / raw)
  To: emacs-orgmode

Ok, I got it working somehow. For others reading this: I had to modify 
~/.emacs.d/straight/repos/org/lisp/ob-maxima.el in emacs(!) so straight 
compiled it to work. you need to replace code at line 82. However, plots 
still doesn't work (code block produced no output) :( pls help.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-01  7:45 [O] Maxima code blocks does not work in windows revisited Mati
@ 2022-11-01  8:04 ` Ihor Radchenko
  2022-11-01 10:34   ` Mati
  0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2022-11-01  8:04 UTC (permalink / raw)
  To: Mati; +Cc: emacs-orgmode

Mati <mati@electrum-bikes.pl> writes:

> Ok, I got it working somehow. For others reading this: I had to modify 
> ~/.emacs.d/straight/repos/org/lisp/ob-maxima.el in emacs(!) so straight 
> compiled it to work. you need to replace code at line 82. However, plots 
> still doesn't work (code block produced no output) :( pls help.

Do you mean that you changed the code at line 82 inside
org-babel-execute:maxima to

 (let* ((cmdline (or (cdr (assoc :cmdline params)) ""))
	  (in-file (org-babel-temp-file "maxima-" ".max"))
		(cmd (format "%s --very-quiet -r \"batchload(\\\"%s\\\")$\" %s"
			     org-babel-maxima-command in-file cmdline)))

??

(for reference, this email is a followup of
https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-01  8:04 ` Ihor Radchenko
@ 2022-11-01 10:34   ` Mati
  2022-11-01 17:42     ` Leo Butler
  2022-11-02  4:47     ` Ihor Radchenko
  0 siblings, 2 replies; 20+ messages in thread
From: Mati @ 2022-11-01 10:34 UTC (permalink / raw)
  To: emacs-orgmode

On 01.11.2022 09:04, Ihor Radchenko wrote:

> Do you mean that you changed the code at line 82 inside
> org-babel-execute:maxima to
>
>   (let* ((cmdline (or (cdr (assoc :cmdline params)) ""))
> 	  (in-file (org-babel-temp-file "maxima-" ".max"))
> 		(cmd (format "%s --very-quiet -r \"batchload(\\\"%s\\\")$\" %s"
> 			     org-babel-maxima-command in-file cmdline)))
>
> ??
>
> (for reference, this email is a followup of
> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)

yes, of course only part of it


I am testing maxima-mode now (not in org) and it works, but is broken on 
windows. Looks like there are many more problems with syntax.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-01 10:34   ` Mati
@ 2022-11-01 17:42     ` Leo Butler
  2022-11-01 21:14       ` Mati
  2022-11-02  4:47     ` Ihor Radchenko
  1 sibling, 1 reply; 20+ messages in thread
From: Leo Butler @ 2022-11-01 17:42 UTC (permalink / raw)
  To: Mati; +Cc: emacs-orgmode@gnu.org

On Tue, Nov 01 2022, Mati <mati@electrum-bikes.pl> wrote:

> On 01.11.2022 09:04, Ihor Radchenko wrote:
>
>> Do you mean that you changed the code at line 82 inside
>> org-babel-execute:maxima to
>>
>>   (let* ((cmdline (or (cdr (assoc :cmdline params)) ""))
>> 	  (in-file (org-babel-temp-file "maxima-" ".max"))
>> 		(cmd (format "%s --very-quiet -r \"batchload(\\\"%s\\\")$\" %s"
>> 			     org-babel-maxima-command in-file cmdline)))
>>
>> ??
>>
>> (for reference, this email is a followup of
>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)
>
> yes, of course only part of it

Please don't make people guess at what you have done. Ihor, in
particular, does a huge amount of work on Org. Making him and us guess
only makes that work harder.

> I am testing maxima-mode now (not in org) and it works, but is broken
> on windows. Looks like there are many more problems with syntax.

I am interested to know what is broken in maxima-mode. Please
explain with examples.

Best,
Leo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-01 17:42     ` Leo Butler
@ 2022-11-01 21:14       ` Mati
  0 siblings, 0 replies; 20+ messages in thread
From: Mati @ 2022-11-01 21:14 UTC (permalink / raw)
  To: emacs-orgmode

>> I am testing maxima-mode now (not in org) and it works, but is broken
>> on windows. Looks like there are many more problems with syntax.
> I am interested to know what is broken in maxima-mode. Please
> explain with examples.
>
> Best,
> Leo

There is problem with handling ghostscript. Ghostscript gui opens three 
times, one time with commands help, and error is displayed in 
minibuffer: "Your version Ghostscript does not appear to support the 
image type -sDEVICE=png16m. The command "gs -h" lists the available 
devices." when it does support it. maybe if I could use setup file it 
would work, but it gives error: Wrong type argument: stringp, nil. I 
also had to correct miktex path in this function, but without 
modification this error occurs too

Overall, configuration on windows is a pain. manually installing 
packages in miktex and ghostscript (not that bad, but I had to dig to 
find that's neccesary), wondering what code actually should be put in 
init.el, finding and moving files from maxima installation to site-lisp, 
adding installation pathes to path environment variable because 
setup-imaxima-imath.el is not working...

Plots produce output but it's not inline in emacs buffer, but gnuplot 
window.

My current path to miktex binary is: 
C:\Users\user\AppData\Local\Programs\MiKTeX\miktex\bin\x64

My init.el config for maxima:

> (add-to-list 'load-path "~/.emacs.d/site-lisp/maxima/")
>
> (load-file "~/.emacs.d/site-lisp/maxima/setup-imaxima-imath.el")
>
> (use-package maxima
>   :custom (maxima-display-maxima-buffer nil)
>   :mode ("\\.ma[cx]" . imaxima)
>   :interpreter ("maxima" . imaxima))
>
> ;;(autoload 'maxima-mode "maxima" "Maxima mode" t)
> (autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
> ;;(autoload 'maxima "maxima" "Maxima interaction" t)
> (autoload 'imath-mode "imath" "Imath mode for math formula input" t)
> ;;(setq imaxima-use-maxima-mode-flag t)
> ;;(setq imaxima-gs-program "gswin64")
> (setq imaxima-fnt-size "large")
> (setq imaxima-pt-size 12)
> ;;(add-to-list 'auto-mode-alist '("\\.ma[cx]" . maxima-mode))
>
> (org-babel-do-load-languages
>  'org-babel-load-languages
>  '((maxima . t))) ; this line activates maxima
>



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-01 10:34   ` Mati
  2022-11-01 17:42     ` Leo Butler
@ 2022-11-02  4:47     ` Ihor Radchenko
  2022-11-02  7:35       ` Mati
  2022-11-02 15:17       ` Max Nikulin
  1 sibling, 2 replies; 20+ messages in thread
From: Ihor Radchenko @ 2022-11-02  4:47 UTC (permalink / raw)
  To: Mati; +Cc: emacs-orgmode

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

Mati <mati@electrum-bikes.pl> writes:

> On 01.11.2022 09:04, Ihor Radchenko wrote:
>
>> Do you mean that you changed the code at line 82 inside
>> org-babel-execute:maxima to
>>
>>   (let* ((cmdline (or (cdr (assoc :cmdline params)) ""))
>> 	  (in-file (org-babel-temp-file "maxima-" ".max"))
>> 		(cmd (format "%s --very-quiet -r \"batchload(\\\"%s\\\")$\" %s"
>> 			     org-babel-maxima-command in-file cmdline)))
>>
>> ??
>>
>> (for reference, this email is a followup of
>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)
>
> yes, of course only part of it

Ok. Does the attached patch work for you?

> I am testing maxima-mode now (not in org) and it works, but is broken on 
> windows. Looks like there are many more problems with syntax.

Org support for Maxima does not require maxima-mode to be installed,
except for optional fontification.

Note that we can only help with within Org scope. We cannot freely modify
Maxima code.

It will be more productive if you contact Maxima developers on the
issue. They do have a mailing list:
https://maxima.sourceforge.io/maximalist.html#discussion


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-maxima-Add-extra-quotes-to-Maxima-cmd-for-Windows.patch --]
[-- Type: text/x-patch, Size: 1303 bytes --]

From 4c1faea44cbe97e53ffb4f78829b86e0da606417 Mon Sep 17 00:00:00 2001
Message-Id: <4c1faea44cbe97e53ffb4f78829b86e0da606417.1667364311.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 2 Nov 2022 12:43:35 +0800
Subject: [PATCH] ob-maxima: Add extra quotes to Maxima cmd for Windows
 compatibility

* lisp/ob-maxima.el (org-babel-execute:maxima): Add extra quoting
apparently needed to make cmd line work on Windows.

Reported-by: Juan Alvaro Fuentes <juanalvaro.fuentes@upct.es>
Link: https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com
---
 lisp/ob-maxima.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
index dba12d7b6..52423db18 100644
--- a/lisp/ob-maxima.el
+++ b/lisp/ob-maxima.el
@@ -84,7 +84,7 @@ (defun org-babel-execute:maxima (body params)
 		(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


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


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-02  4:47     ` Ihor Radchenko
@ 2022-11-02  7:35       ` Mati
  2022-11-02  7:44         ` Ihor Radchenko
  2022-11-02 15:17       ` Max Nikulin
  1 sibling, 1 reply; 20+ messages in thread
From: Mati @ 2022-11-02  7:35 UTC (permalink / raw)
  To: emacs-orgmode

Ok, I tried this patch, but now when I try to eval maxima code it 
outputs similar broken table:

| incorrect | syntax: | c | is | not | an | infix | operator |
| ^        |        |   |   |     |    |      |         |

Plots have no output as before.

To clarify, previous patch worked except plots. And of course I applied 
patch to fresh org repo downloaded with straight.el



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-02  7:35       ` Mati
@ 2022-11-02  7:44         ` Ihor Radchenko
       [not found]           ` <7b358b1a-95d8-4733-5a44-4e6e4c782d8f@electrum-bikes.pl>
  0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2022-11-02  7:44 UTC (permalink / raw)
  To: Mati; +Cc: emacs-orgmode

Mati <mati@electrum-bikes.pl> writes:

> Ok, I tried this patch, but now when I try to eval maxima code it 
> outputs similar broken table:
>
> | incorrect | syntax: | c | is | not | an | infix | operator |
> | ^        |        |   |   |     |    |      |         |
>
> Plots have no output as before.

Could you please describe what exactly you tried, what you expected, and
what you got?

My patch should be equivalent to originally proposed, but
I am not exactly sure what you have applied on your side. And I have no
idea which table you are talking about.

See https://orgmode.org/manual/Feedback.html#Feedback

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-02  4:47     ` Ihor Radchenko
  2022-11-02  7:35       ` Mati
@ 2022-11-02 15:17       ` Max Nikulin
  2022-11-02 20:11         ` Leo Butler
                           ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Max Nikulin @ 2022-11-02 15:17 UTC (permalink / raw)
  To: emacs-orgmode

On 02/11/2022 11:47, Ihor Radchenko wrote:
>>> (for reference, this email is a followup of
>>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)

Ihor, you recently applied an alternative patch to Org main branch. 
Emacs tree still has ob-maxima.el with single quotes around batchload.

Nikolay Kudryavtsev. Re: [PATCH] ob-maxima.el: Fix execution on MS 
Windows. Thu, 30 Dec 2021 23:54:10 +0300. 
https://list.orgmode.org/8cd49b4c-9342-a77f-d665-402c41432b57@gmail.com

> diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
> index dba12d7b6..52423db18 100644
> --- a/lisp/ob-maxima.el
> +++ b/lisp/ob-maxima.el
> @@ -84,7 +84,7 @@ (defun org-babel-execute:maxima (body params)
>  		(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))

Notice that code in the message you cited has "%s" and does not have 
`shell-quote-argument'. Extra quotes may discard effect of existing 
double pass escaping.

>                               cmdline)))
>  	   (with-temp-file in-file (insert (org-babel-maxima-expand body params)))
>  	   (message cmd)

Really robust solution require a dedicated maxima option that allows to 
pass file name as a separated argument instead of a part of expression,




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-02 15:17       ` Max Nikulin
@ 2022-11-02 20:11         ` Leo Butler
  2022-11-03  2:35           ` Max Nikulin
  2022-11-03  6:08         ` Ihor Radchenko
  2022-11-03  6:09         ` Ihor Radchenko
  2 siblings, 1 reply; 20+ messages in thread
From: Leo Butler @ 2022-11-02 20:11 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode@gnu.org

On Wed, Nov 02 2022, Max Nikulin <manikulin@gmail.com> wrote:

> On 02/11/2022 11:47, Ihor Radchenko wrote:
>>>> (for reference, this email is a followup of
>>>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)
>
> Ihor, you recently applied an alternative patch to Org main
> branch. Emacs tree still has ob-maxima.el with single quotes around
> batchload.
>
> Nikolay Kudryavtsev. Re: [PATCH] ob-maxima.el: Fix execution on MS
> Windows. Thu, 30 Dec 2021 23:54:10 +0300. 
> https://list.orgmode.org/8cd49b4c-9342-a77f-d665-402c41432b57@gmail.com
>
>> diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
>> index dba12d7b6..52423db18 100644
>> --- a/lisp/ob-maxima.el
>> +++ b/lisp/ob-maxima.el
>> @@ -84,7 +84,7 @@ (defun org-babel-execute:maxima (body params)
>>  		(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))
>
> Notice that code in the message you cited has "%s" and does not have
> `shell-quote-argument'. Extra quotes may discard effect of existing 
> double pass escaping.

Yes, OP should try this solution first. If it fails, then there is
some problem in `shell-quote-argument' that needs to be fixed.

My 2c.
Leo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-02 20:11         ` Leo Butler
@ 2022-11-03  2:35           ` Max Nikulin
  2022-11-03 10:01             ` Fraga, Eric
  0 siblings, 1 reply; 20+ messages in thread
From: Max Nikulin @ 2022-11-03  2:35 UTC (permalink / raw)
  To: emacs-orgmode

On 03/11/2022 03:11, Leo Butler wrote:
> On Wed, Nov 02 2022, Max Nikulin wrote:
> 
>> On 02/11/2022 11:47, Ihor Radchenko wrote:
>>>>> (for reference, this email is a followup of
>>>>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)
>>
>> Ihor, you recently applied an alternative patch to Org main
>> branch. Emacs tree still has ob-maxima.el with single quotes around
>> batchload.
>>
>> Nikolay Kudryavtsev. Re: [PATCH] ob-maxima.el: Fix execution on MS
>> Windows. Thu, 30 Dec 2021 23:54:10 +0300.
>> https://list.orgmode.org/8cd49b4c-9342-a77f-d665-402c41432b57@gmail.com
>>
>>> diff --git a/lisp/ob-maxima.el b/lisp/ob-maxima.el
>>> index dba12d7b6..52423db18 100644
>>> --- a/lisp/ob-maxima.el
>>> +++ b/lisp/ob-maxima.el
>>> @@ -84,7 +84,7 @@ (defun org-babel-execute:maxima (body params)
>>>   		(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))
>>
>> Notice that code in the message you cited has "%s" and does not have
>> `shell-quote-argument'. Extra quotes may discard effect of existing
>> double pass escaping.
> 
> Yes, OP should try this solution first. If it fails, then there is
> some problem in `shell-quote-argument' that needs to be fixed.

To be clear. I believe that Mati should try the code from the Org "main" 
branch, not the patch Ihor posted in this thread. If I got it correctly, 
Mati currently has some problems with plots, ghostscript, etc.

Is there anything wrong with the following command (I am unsure 
concerning Temp location)? If so, what is the proper escaping for 
cmd.exe+maxima?

(let ((system-type 'ms-dos)
       (org-babel-maxima-command "maxima")
       (in-file "c:\\Temp\\maxima-XXXXXX.max")
       (cmdline ""))
   (message
    "%s"
    (format "%s --very-quiet -r %s$ %s"
	   org-babel-maxima-command
	   (shell-quote-argument
	    (format "batchload(%S)" in-file))
	   cmdline)))

maxima --very-quiet -r "batchload(\"c:\\Temp\\maxima-XXXXXX.max\")"$

(there is a trailing space)




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-02 15:17       ` Max Nikulin
  2022-11-02 20:11         ` Leo Butler
@ 2022-11-03  6:08         ` Ihor Radchenko
  2022-11-03  6:09         ` Ihor Radchenko
  2 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2022-11-03  6:08 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 02/11/2022 11:47, Ihor Radchenko wrote:
>>>> (for reference, this email is a followup of
>>>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)
>
> Ihor, you recently applied an alternative patch to Org main branch. 
> Emacs tree still has ob-maxima.el with single quotes around batchload.
>
> Nikolay Kudryavtsev. Re: [PATCH] ob-maxima.el: Fix execution on MS 
> Windows. Thu, 30 Dec 2021 23:54:10 +0300. 
> https://list.orgmode.org/8cd49b4c-9342-a77f-d665-402c41432b57@gmail.com

Thanks for pointing this out!
I do not use Windows, so it is hard to check how things are there. I
assumed that the report herein is not the latest main, which may or may
not be the case.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-02 15:17       ` Max Nikulin
  2022-11-02 20:11         ` Leo Butler
  2022-11-03  6:08         ` Ihor Radchenko
@ 2022-11-03  6:09         ` Ihor Radchenko
  2 siblings, 0 replies; 20+ messages in thread
From: Ihor Radchenko @ 2022-11-03  6:09 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

> On 02/11/2022 11:47, Ihor Radchenko wrote:
>>>> (for reference, this email is a followup of
>>>> https://orgmode.org/list/CA+ikm3wqA33xP4c3pVV+F2a-gn0dbEzsdx6Vf2cRd+37+u6pBA@mail.gmail.com)
>
> Ihor, you recently applied an alternative patch to Org main branch. 
> Emacs tree still has ob-maxima.el with single quotes around batchload.
>
> Nikolay Kudryavtsev. Re: [PATCH] ob-maxima.el: Fix execution on MS 
> Windows. Thu, 30 Dec 2021 23:54:10 +0300. 
> https://list.orgmode.org/8cd49b4c-9342-a77f-d665-402c41432b57@gmail.com

Thanks for pointing this out!
I do not use Windows, so it is hard to check how things are there. I
assumed that the report herein is on the latest main, which may or may
not be the case.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-03  2:35           ` Max Nikulin
@ 2022-11-03 10:01             ` Fraga, Eric
  2022-11-03 15:54               ` Max Nikulin
  0 siblings, 1 reply; 20+ messages in thread
From: Fraga, Eric @ 2022-11-03 10:01 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode@gnu.org

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?
-- 
: Eric S Fraga, with org release_9.5.5-853-g7b9d8e in Emacs 29.0.50

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
       [not found]             ` <87eduk8tas.fsf@localhost>
@ 2022-11-03 11:39               ` Mati
  0 siblings, 0 replies; 20+ messages in thread
From: Mati @ 2022-11-03 11:39 UTC (permalink / raw)
  To: emacs-orgmode


> As Max pointed out, the latest main branch of Org should already handle
> Windows cmd properly without any extra patches. Did you try it? May I
> know the output of M-x org-version?

9.5.5-g5bc674, I just pulled it, rebuilt and works properly (without plots)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: Maxima code blocks does not work in windows revisited
  2022-11-03 10:01             ` Fraga, Eric
@ 2022-11-03 15:54               ` Max Nikulin
  2022-11-03 16:09                 ` [PATCH] " Leo Butler
  0 siblings, 1 reply; 20+ messages in thread
From: Max Nikulin @ 2022-11-03 15:54 UTC (permalink / raw)
  To: emacs-orgmode

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.

P.S. To avoid tricky escaping I strongly prefer direct exec to shell 
commands. Unfortunately as soon as TRAMP is involved, shell is the only 
option. Ssh supports command strings only and passes them to shell.




^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] Re: Maxima code blocks does not work in windows revisited
  2022-11-03 15:54               ` Max Nikulin
@ 2022-11-03 16:09                 ` Leo Butler
  2022-11-06  2:54                   ` Ihor Radchenko
  0 siblings, 1 reply; 20+ messages in thread
From: Leo Butler @ 2022-11-03 16:09 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode@gnu.org

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

On Thu, Nov 03 2022, Max Nikulin <manikulin@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch.patch --]
[-- Type: text/x-diff; name="0001-lisp-ob-maxima.el-correct-placement-of-in-command-st.patch", Size: 1516 bytes --]

From 423340175a354463c82fac2b4b3a404391e67eb5 Mon Sep 17 00:00:00 2001
From: Leo Butler <leo.butler@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-276f6a452eaa@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


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] Re: Maxima code blocks does not work in windows revisited
  2022-11-03 16:09                 ` [PATCH] " Leo Butler
@ 2022-11-06  2:54                   ` Ihor Radchenko
  2022-11-07 15:04                     ` Leo Butler
  0 siblings, 1 reply; 20+ messages in thread
From: Ihor Radchenko @ 2022-11-06  2:54 UTC (permalink / raw)
  To: Leo Butler; +Cc: Max Nikulin, emacs-orgmode@gnu.org

Leo Butler <Leo.Butler@umanitoba.ca> writes:

>> 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'.

Thanks for your contribution!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9abf1b5167e94291eee7c1400277ed55993106f9

You are now also listed as an Org mode contributor.
https://git.sr.ht/~bzg/worg/commit/8750cbeccf4283be5ec7078f635f8328b2cbee09

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] Re: Maxima code blocks does not work in windows revisited
  2022-11-06  2:54                   ` Ihor Radchenko
@ 2022-11-07 15:04                     ` Leo Butler
  0 siblings, 0 replies; 20+ messages in thread
From: Leo Butler @ 2022-11-07 15:04 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Max Nikulin, emacs-orgmode@gnu.org

On Sun, Nov 06 2022, Ihor Radchenko <yantar92@posteo.net> wrote:

> Leo Butler <Leo.Butler@umanitoba.ca> writes:
>
>>> 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'.
>
> Thanks for your contribution!
> Applied onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9abf1b5167e94291eee7c1400277ed55993106f9
>
> You are now also listed as an Org mode contributor.
> https://git.sr.ht/~bzg/worg/commit/8750cbeccf4283be5ec7078f635f8328b2cbee09

Thanks, Ihor.
Leo

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-11-07 15:05 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01  7:45 [O] Maxima code blocks does not work in windows revisited Mati
2022-11-01  8:04 ` Ihor Radchenko
2022-11-01 10:34   ` Mati
2022-11-01 17:42     ` Leo Butler
2022-11-01 21:14       ` Mati
2022-11-02  4:47     ` Ihor Radchenko
2022-11-02  7:35       ` Mati
2022-11-02  7:44         ` Ihor Radchenko
     [not found]           ` <7b358b1a-95d8-4733-5a44-4e6e4c782d8f@electrum-bikes.pl>
     [not found]             ` <87eduk8tas.fsf@localhost>
2022-11-03 11:39               ` Mati
2022-11-02 15:17       ` Max Nikulin
2022-11-02 20:11         ` Leo Butler
2022-11-03  2:35           ` Max Nikulin
2022-11-03 10:01             ` Fraga, Eric
2022-11-03 15:54               ` Max Nikulin
2022-11-03 16:09                 ` [PATCH] " Leo Butler
2022-11-06  2:54                   ` Ihor Radchenko
2022-11-07 15:04                     ` Leo Butler
2022-11-03  6:08         ` Ihor Radchenko
2022-11-03  6:09         ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2022-10-31 22:00 [O] " ELECTRUM BIKES

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).