Issues with the octave plugin – Symbolic pkg not working properly

Dear @Tilda,

many thanks for testing octaveX.
The quality of plots is because my main use of TeXmacs (and motivation to write ocatveX) is to obtain in graphical form behavior of models, or plotting data and so on so I focused on that.

Concerning your issues:

  1. the strange behavior of ‘ans’ is my fault, because ‘ans’ was redefined by mistake in octaveX. Thanks for spotting this issues.
    Fixed. (changing the internal variable ‘ans’ to ‘octaveXans’).
    BTW, the strange numbers you got were the ascii codes of the word ‘texmacs’…
    Now this works, see below:image1

Just one more comment on that: you may note that the ‘double(ans)’ command has no output, while the three rows immediately below have.
This because octaveX adds to every input a semicolon at the end, to avoid excessive outputs (this behavior was actually inherited from a very ancient octave plugin. I decided to maintain it, makes sense if you are interested in graphical output only…).
In a future version I may add a switch to control this, but at the moment there are three ways to overcome that:

a. add a # at the end of the command, this makes the semicolon become a comment, or,
b. asking to explictely display the output with the standard octave disp() command, or
c. use tmdisp(), a display command defined in octaveX, which try to print the output in a fancier way (e.g. for vectors and matrices)

  1. Your second issue. My feeling is that here there is a similar problem, I need to investigate better, but it will take some time. I think so because if you do the same computation e.g. using as symbols x and y, instead of x and r, everyting is just fine (see next post: it seems I cannot post two images at once…) So probably something concerning the symbol ‘r’ is hidden somewhere in octaveX.
    Again to obtain the output we need to force it with the ‘#’ at the end of the lines.

Once I can fix this second issue I will release an updated version.

Best,
Lorenzo

1 Like

1 Like

Dear @Tilda,
a further update.

I managed to resolve also the issue related to the use of ‘r’ as symbol, so I realesed a new version of octaveX (0.3.3).
The link is:
https://github.com/AFMiJ/TeXmacs-related/releases/download/v0.3.3/octaveX.zip

Please, test it. Also the difference in output between tmmod(‘n’) and tmmod(‘i’) should be gone, but please try.

I also resolved some other minor bugs, and I added a new command (tmtoggleoctavereply) to toggle the suppression of octave output text when issuing commands.
Also added a new menu entry for this command, see the image below.


Activating the octave reply makes by default visible the output of e.g. the symbolic package, which is probably a better choice in this case.
I would like to insert here an image of a session where this command is used to activate and deactivate again the octave output, but this forum does not let me to attach more than an image per post, nor replying with a further post (says: new users are limited to 3 replies or something like that), so sorry no image.

In this case you have to pay attention though to suppress the output in some cases, adding manually the semicolon ad the end of the command.
E.g., when defining some relatively long vectors or matrices may make TeXmacs extremely poorly responsive, adding several pages to your document, even in cases when the cli output is perfectly fine.
It is probably better to turn off the octave output when dealing with numeric computation.

Best,
Lorenzo

changes added in v. 0.3.3
tmtoggleoctavereply.m (new, toggle the visibility status of output from octave)
tmprefs.m (updated, added control of status of octave reply)
tmrepl.m (updated, changed variable names to avoid conflicts with user variables, added option to control visibility of octave reply)
tmmod.m (updated, check if the ‘qt’ graphics toolkit is available before activating the ‘svgconversion option’)
tmverb.m (updated, added disp command to show info)
tminfo.m (updated, added disp command to show info)
tmfig.m (updated, the “-nosvgconvert” option was missing. That triggered an error when the qt graphics toolkit was unavailable)
.octaverc (updated, added default plotting mode as ‘normal’, added control of octave reply)

1 Like

Dear @Lorenzo

Thanks for your detailed reply and the information on some of the inner workings of your plugin v0.3.1 as well as suggestions for workarounds.

After having been merrily octaveXing yesterday, I was not able to start octaveX this afternoon. I´ve tried all sort of things, like deleting the $HOME/.TeXmacs/* directory, starting the iMac in safe mode, running various cleanup programs, but to no avail. Each time I wanted to start octaveX the session immediately froze.

I have no idea why I can’t get octaveX running again, particularly as the other plugins that I regularly use still work correctly. So, unfortunately, I have been unable to test your suggestions myself.

Also, I would like to thank you for the effort and all improvements that you put in making octaveX v0.3.3 available earlier this evening. I immediately installed it, but alas, I can’t get v0.3.3 running either. It seems as if my computer is sort of bewitched :disappointed:

Cheers, Tilda

Dear @Tilda,
I am sorry for this problem, but we can try to understand what happened.
It is not so easy to spot what went wrong from far away, but there are still some tests that can be done.

When you can find some time, these are some basic things that you can start to test:

  1. First, remove (again) the octaveX folder and reinstall it.
  2. Then, check if the (normally hidden) file .octaverc is there (see the image below – to show hidden files, you should press Shift + Command + . (period) in an activated Finder window).
    dot_octaverc
  3. In both cases (file exists or not), close every instance of the TeXmacs app and reopen it.
    Is the standard octave plugin working? (*if not see below). Open it.
    In the octave session, copy and paste the following commands
    disp(getpref(“OctaveX”))
    rmpref (“OctaveX”)
    disp(getpref(“OctaveX”))
    disp(getenv(“TEXMACS_HOME_PATH”))
    And post here the results.
  4. Close again TeXmacs, open it, is the octaveX session available in the Insert-> Session menu? If yes open it, is there any output in TeXmacs? take a screenshot and please post it here.

This is enough for the moment.

Best,
Lorenzo

*Note. Only in case even the standard octave plugin is not working, let me know. Then, open an octave cli-session (only be sure to use the same octave app that is used by the TeXmacs plugins), and issue the following commands:
disp(getpref(“OctaveX”))
rmpref (“OctaveX”)
disp(getpref(“OctaveX”))
Posting here the results

1 Like

Dear @Lorenzo

as you suggested I did the following:

  1. removed and reinstalled octave X

  2. made sure that .octaverc is there

  3. closed every instance of TeXmacs and reopened it. The standard octave plugin is working, and these commands gave the following results:

  4. After closing, restarting TeXmacs and finding the octaveX session available in the Insert->Session menu, trying to open it resulted in a frozen session as before:

Hope this helps.

Cheers, Tilda

I’m not sure what is going on but one should be aware that there are various ways to install Octave on Mac (I believe) and that this affects the ability of the various plugins to find the executable. If Octave is installed as a standard MacOS app it will live in a path inside something like /Applications/Octave.app and the standard octave plugin should be able to find it. If instead it is installed via Homebrew (for example), then as a Unix executable, it will live in something like /opt/homebrew/bin (in my installation) and this path could not be in the current application environment variable PATH which tells the system where to find executables. If the current PATH is not configured correctly, TeXmacs will not be able to find the executable. In particular, even if in a shell you see a correct path, TeXmacs could still have a different one. To check the PATH which affects TeXMacs, run

(getenv "PATH")

in a Scheme session. To set a different path for the application, run

(setenv "PATH" (string-append "/opt/homebrew/bin:" (getenv "PATH")))

for example. This should allow you to test if you can make the executable reachable to TeXmacs or not. For what I can see, the octaveX plugins is looking for the octave-cli executable. On my system however the PATH is not corrected for homebrew-installed software so TeXmacs cannot find the executable and I see


After modifying the PATH in the way suggested above (which is TEMPORARY to the current TeXmacs session) I can run the plugin just fine:

Unfortunately the current methods with which TeXmacs tries to find plugins is not very suitable for the multiple ways one can install software on the Mac, in particular it will not try to guess the possible paths in which a particular executable is installed via Homebrew or MacPorts or other Unix-like packaging systems. As developers I think we should provide the user options to easily modify or suggest a correct path to TeXmacs, or make the system more reliable.

@Tilda where is your octave executable?

2 Likes

Dear @mgubi,

MacPorts installed octave and octave-cli to /opt/local/bin, and they should be in $PATH as the standard octave-plugin launches. This is further confirmed by running 54

I also tried your 10
As before, the octaveX session is in the Busy-loop and does not launch. Which does not really surprise me as /opt/local/bin: has already been in TeXmacs PATH environment before.

What really bothers me is the fact that the day before yesterday I had no problem repeatedly launching octaveX sessions on two computers. These issues only started Friday morning (on both systems). They continued to be there, even after installing Lorenzo’s most recent update.

Cheers, Tilda

The shell path is not faithful as the shell might set up a different path from TeXmacs in its init script. Please try to check the path via Scheme (starting TeXmacs again) with:

(getenv "PATH")

Anyway seems indeed a different problem as the plugin would complain if cannot find the executable.
Maybe the .octaverc file is corrupted?

It might help to run TeXmacs from the terminal, turn on “io” debugging messages and then try to start a session.

That should display the command TeXmacs tries to run and any messages that are sent to and received from the plugin on the terminal.

Dear @mgubi,

I checked


and /opt/local/bin: is indeed already in TeXmacs PATH.

Which .octaverc file are you referring to? My personal .octaverc which has been unchanged since June 24 or the .octaverc provided by octaveX?

The PATH looks strange, it seems to be corrupted, these error messages should not be there. It might be that you have an error in .bash_profile. This might not show up when you run the shell so there you see a normal path, but the PATH TeXmacs sees is corrupted as you try to run pyenv but it could not be found. Probably because you have to set up correctly the PATH in the first place for it to be found.

@mgubi,

As pynenv is currently not installed on my system, I uncommented the lines relating to pynenv in my .bash_profile, and the error messages seem to have gone:

Yet the octaveX session still freezes:

Dear @jeroen,

How do I do that?

Cheers, Tilda

Dear @Tilda,
dears all,

an updated version here:

https://github.com/AFMiJ/TeXmacs-related/releases/download/v0.3.3a/octaveX.zip

As usually, you may have to update the plugins with Tools->Update->Plugins, maybe more than one time.

Please try it and tell me if this works.
If yes, plaese issue the following commands in an OctaveX session and post the output:

tmprefs

tminfo

Best,
Lorenzo

3 Likes

Dear @Lorenzo,

I’ve downloaded octaveX v0.3.3a, and hurray, the plugin is working again on my iMac!! And here’s the diagnostic output:

The plugin seems to be working, yet I have to add a # at the end of every command that outputs s.th.

Compare this with post #19. Thanks also for fixing the syms x r issue:

I will be testing the improved tmmod(‘n’) and tmmod(‘i’) options tomorrow and report back if the differences in output have gone. Again, thanks for making this all possible. :relaxed:

Cheers, Tilda

3 Likes

Dear @Tilda,

I’m happy that the plugin works.
Concerning the (lack of) output this is okay with your current configuration:
if you look at the output of the tmprefs command it says: octave reply hidden.
To change that, place the cursor in an empty octaveX prompt, and click on the ‘Toggle reply mode’ menu entry (of the ocatveX dedicated menu).
The octaveX menu becomes visible when the cursor is in a octaveX prompt, otherwise is hidden.

If for some reason the menu is not present, you can obtain the same effect digiting the command

tmtoggleoctavereply

at the octaveX prompt.
You can check the new status again with the
tmprefs
command.
The fourth row should be now: octave reply is shown
These preferences are stored on disk, should be reloaded in the new sessions.

Best,
Lorenzo

3 Likes

Seems you may not need it anymore, but for future reference: first turn on Tools->Debugging Tool, then enable Debug->io.

2 Likes

Dear @Lorenzo,

thanks for the explanations on changing the current octaveX configuration. These changes you suggested work fine. You mentioned that new preferences will be saved to disk. Is ~/.ocatave_prefs the file where the information goes to?

I did some plots yesterday evening:

  1. 3d plot with tmmod('i')

  2. 3d plot in the official octave plugin

  3. 3d plot with tmmod('n')

As I cannot upload pdf-files, I would like to email you these files. And we can discuss the differences in detail in a more private setting.

Cheers, Tilda

Dear @Tilda,

yes, prefs are stored in the .octave_prefs file, but this is a file managed by octave itself, octaveX uses octave function calls to store there its prefs.
Best,
Lorenzo