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; 10+ 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] 10+ 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; 10+ 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] 10+ messages in thread

* Re: [O] Maxima code blocks does not work in windows revisited
  2022-11-01  7:45 Mati
@ 2022-11-01  8:04 ` Ihor Radchenko
  2022-11-01 10:34   ` Mati
  0 siblings, 1 reply; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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
  1 sibling, 1 reply; 10+ 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] 10+ 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
  0 siblings, 1 reply; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ messages in thread

end of thread, other threads:[~2022-11-03 11:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-31 22:00 [O] Maxima code blocks does not work in windows revisited ELECTRUM BIKES
  -- strict thread matches above, loose matches on Subject: below --
2022-11-01  7:45 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

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