From: Eric S. <ste...@gm...> - 2021-03-11 13:49:24
|
Hi Leo, somehow, I didn't receive your response from the mail-list. Could it be that's because I accidentally attached my public key? Thanks to Robert Dodier for the hint. I can reproduce your results using your re-written init file: eric@Medina:~$ maxima -q --userdir=/home/eric/documents/R/packages/rmaxima/inst/extdata/ --init=maxima-init-tex1 prompt;>>(%i1) <<prompt;L: sqrt(1 - 1/(R^2)); out;>>(%o1) $$\sqrt{1-\frac{1}{R^2}}$$ <<out; prompt;>>(%i2) <<prompt;integrate(x, x, 0, L); prompt;>>out;>>(Is R positive or negative?) $$\mathbf{false}$$ <<out;<<prompt; p; out;>>(%o2) $$\frac{R^2-1}{2\,R^2}$$ <<out; prompt;>>(%i3) <<prompt; Thank you so much! You guys are great :) I have not yet written test cases, since I haven't got this "feature" implemented, but now I can start to do so and see if it also works for the other ask functions. I'll surely get back here, once that's done. Eric > Hi Eric, > > I think that you have found a bug in alt-display. With the attached > patch, your code works fine for me. I have taken the liberty to re-write > your my_display function so that it uses printf, rather multiple calls > to princ. > > Can you test out the patch, please? > > Leo > > > #+begin_src maxima > (load("mactex-utilities"), load("alt-display.mac")); > (set_prompt('prefix, "prompt;>>",'suffix, "<<prompt;"), > my_display(x):=(printf(true,"out;>>(~a) ~a~a~a~%<<out;",?cadr(x),"$$",tex1(?caddr(x)),"$$")), > set_alt_display(2,my_display)) $ > #end_src > > #+RESULTS: > :RESULTS: > $ ~/maxima/sandbox/git/maxima-code/maxima-local --init=/dev/null > Maxima branch_5_44_base_272_g8dac75087http://maxima.sourceforge.net <http://maxima.sourceforge.net> > using Lisp SBCL 2.1.1.debian > Distributed under the GNU Public License. See the file COPYING. > Dedicated to the memory of William Schelter. > The function bug_report() provides bug reporting information. > (%i1) (load("mactex-utilities"), load("alt-display.mac")); > (%o1) /home/work/maxima/sandbox/git/maxima-code/share/contrib/alt-display/alt-\ > display.mac > > (%i2) (set_prompt('prefix, "prompt;>>",'suffix, "<<prompt;"), > my_display(x):=(printf(true,"out;>>(~a) ~a~a~a~%<<out;",?cadr(x),"$$",tex1(?caddr(x)),"$$")), > set_alt_display(2,my_display)) $ > > prompt;>>(%i3) <<prompt;L: sqrt(1 - 1/(R^2)); > out;>>(%o3) $$\sqrt{1-\frac{1}{R^2}}$$ > <<out; > prompt;>>(%i4) <<prompt;integrate(x, x, 0, L); > prompt;>>Is R positive or negative? > <<prompt; > p; > out;>>(%o4) $$\frac{R^2-1}{2\,R^2}$$ > <<out; > prompt;>>(%i5) <<prompt; > > :END: > > Leo On 08.03.21 16:05, Eric Stemmler wrote: > > Hello Everyone, > > I'm following the advice of Robert Dodier to move this discussion to > here from > https://stackoverflow.com/questions/66502778/maxima-how-to-preserve-prompt-message-to-user-e-g-asksign-when-customizing?noredirect=1#comment117604074_66502778 > <https://stackoverflow.com/questions/66502778/maxima-how-to-preserve-prompt-message-to-user-e-g-asksign-when-customizing?noredirect=1#comment117604074_66502778> > > I'm developing an interface to Maxima (from R), that changes the > output display of maxima on startup via an init-file: > > |load("mactex-utilities")$ load("alt-display.mac")$ > set_prompt('prefix, "prompt;>>")$ set_prompt('suffix, "<<prompt;")$ > my_display(x):=(?princ("out;>>"), ?princ("(%o"), ?princ(linenum), > ?princ(") "), tex(?caddr(x)), ?princ("<<out;"))$ set_alt_display(2, > my_display)$ | > > Now I'm trying to handle cases were Maxima prompts the user to declare > assumptions about variables like in this example: > > |(%i1) L: sqrt(1 - 1/(R^2)); 1 (%o1) sqrt(1 - --) 2 R (%i2) > integrate(x, x, 0, L); Is R positive or negative? positive; 2 R - 1 > (%o2) ------ 2 2 R (%i3) | > > So the default display shows a prompt message "Is R positive or > negative?". However, when I use the initialization file above, this > message does not get printed. However, the console waits for the user > input. So my question is, if there is a way, so I can include it in my > customized output. Preferably, I think it should be possible to also > wrap it in pre-/suffix strings for my interface to properly catch it, > but I'm not too versed with maxima and it's internals. I know only a > little bit of CLISP. > > Just for the record, my interface's repo is > https://www.github.com/rcst/rmaxima <https://www.github.com/rcst/rmaxima> > > Best regards, > > Eric > > || > || |