FriCAS & TeXmacs (plugin enhancements + SPAD support)
🚧 work in progress
Using the pattern matcher of guile/scheme.
The TexmacsSupport package allows to control most of the TeXmacs
menu commands from FriCAS.
One may use the FriCAS startup file ~/.fricas.input to tailor the initial
TeXmacs environment.
Example:
-- Usage: quickLoad pkg
-- => same as )lisp (ql:quickload pkg)
macro quickLoad(s) ==
syscmd(s) ==> systemCommand(s)$MoreSystemCommands
lisp2(f,a) ==> syscmd string(FORMAT('NIL,"lisp (~A _"~A_")",f,a)$Lisp)
syscmd "lisp (defvar |$inclAssertions| NIL)"
lisp2("load", "~/quicklisp/setup")
lisp2("ql:quickload",s)
-- Usage: setPromot("beforeNumber","afterNumber")
-- Example: setprompt("",". ") --> "10. " instead of "(10)-> "
macro setPrompt(beg,end) ==
syscmd(s) ==> systemCommand(s)$MoreSystemCommands
fmt1:="(DEFUN MKPROMPT () (PROG () (RETURN (STRCONC "
fmt2:="(STRINGIMAGE |$IOindex|) "
fmt3:= "))))"
cmd:="lisp " fmt1 "_"" beg "_"" fmt2 "_"" end "_"" fmt3
syscmd(cmd)
-- Usgae: lisp str (evaluates the string in Lisp and returns an SExpression)
lisp(s:String):SExpression == EVAL(READ_-FROM_-STRING(s)$Lisp)$Lisp
-- If one calls the following macro, the prompt will be changed
-- the package TMSPT will be loaded (if in ~/quicklisp/local-projects),
-- the "types" output will be redefined and the start banner will be deleted.
macro tmenv ==
setPrompt("",". ")
quickLoad tmspt
ioHook()
removeBanner()
One may also call a FriCAS session in TeXmacs by a shell script. The example
below will start TeXmacs then creates a FriCAS session and calls the macro
tmenv() from .fricas.input (if defined).
#!/bin/sh
#if [ -z "$1" ]; then echo *.input ... filename expected; exit 1; fi
texmacs -x "(begin \
(make-session \"fricas\" \"default\") \
(insert \"tmenv() \") \
(session-evaluate))"
TODO:
- more math input patterns
- menu
- documentation
- tidy up
📅 15-JAN-2025 :revised: 15-AUG-2025

