Macro/Command/Shortcut for opening (CAS) session

Is there a macro, a command or a shortcut for opening a session, like for example a Maxima session?

I saw the session macro, but could not really make sense out of it’s documentation.

How would I as a beginner in general find the macros/commands/shortcuts associated with menus?

Assuming that the binaries are in the path, you could try the code below in your my-init-texmacs.scm in ~/.TeXmacs/progs/ and adapt accordingly.

;;
;;=============================
;; Start/insert sessions
;;=============================
;;
(kbd-map
(“M-i m” (make-session “maxima” “default”))
;;“M-s m” (make-session “maxima” “default”)) ;; M-s is save to file on macOS
(“M-i g” (make-session “giac” “default”))
(“M-i l” (make-session “matlab” “default”))
(“M-i o” (make-session “octave” “default”))
(“M-i p” (make-session “python” “default”))
(“M-i r” (make-session “reduce” “default”))
(“M-i s” (make-session “sage” “default”))
(“M-i w” (make-session “maple” “default”))
)

Pressing Meta-key +i simultaneously and then m launches a Maxima session.

Hope this helps.
Cheers, Tilda

1 Like

Thanks, this is one possibility.

Can I also call the make-session command directly?

I don’t understand your question. Can you try and phrase it differently?

For finding out which Scheme functions correspond to a menu item, the only way I know of is to make a text search with as key the menu entry in the progs directory of the TeXmacs installation. You can do it in the GitHub repository, which as a nice search facility; for doing it locally I use ack.

Hi @pireddag,

Thanks and sorry for not having explained better:
Say I would like to open an Octave or a Maxima session. I could do this via the graphical menu, but this slows me down because my hand has to leave the keyboard for using the mouse.
Therefore, I try to use keyboard shortcuts or type in commands whenever possible. Defining a shortcut for opening a session like @Tilda wrote would be a possibility.
Using the M-x key combination allows me to run Scheme commands. I tried to run make-session as a command, but this didn’t insert a new session.

I tried it and I have been able to insert a new session. I had to type in the quotes in "python"; when I pasted them, characters different from " were pasted and Scheme did not recognize them as string delimiters, so thought they were part of the name of a non-existent variable.

I used M-S-x, not M-x. I do not understand the difference between the two commands, but with M-x my Scheme commands did not work.

1 Like

Thanks @pireddag, this was exactly what I was looking for!
Just for those people arriving at this question via web search: It is necessary to type the key combination Meta Shift x and just enter make-session. This will open a dialog in which it is necessary to enter the desired language (like maxima or octave) and default.