Are there any good methods to help developing scheme modules?

I am now working on developing a markdown-to-texmacs converter, and I would like to know if there is any good, efficient method of scheme code development.
I found that all of the interfaces that open to me are written by scheme, but it seems not easy to locate definitions nor debug interactively. Everything needs to be compiled first, which consumes a lot of time.
Nevertheless, I found two ways to alleviate this problem:

  1. Use"Scheme Session" in TeXmacs and debug. After reading TeXmacs scheme dev guide, it seems I can redefine modules thanks to the dynamic design, and the session works well. However, I am not sure if this is a standard development procedure.
  2. Read documents. It is not convenient to locate definitions though, the guide book provides lots of API descriptions. But this can be time-consuming too.

Are there any better tricks or methods to help developing scheme modules?

2 Likes

Tools -> Developer Tool

  • Browse the documentation generated from scheme code
  • Jump to the definition of a specific function

Tools -> Debugging Tool

Darcy’s Development Procedure for Scheme Code

Three steps to use the cusomized TEXMACS_PATH:

  1. Assuming that the whole src code is cloned at $HOME/texmacs/texmacs
  2. cp the extra ice-9 directory to the source code directory
    cp -r /Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/progs/ice-9 $HOME/texmacs/texmacs/TeXmacs/progs
    
  3. Launch TeXmacs with customized TEXMACS_PATH
    TEXMACS_PATH=$HOME/texmacs/texmacs/TeXmacs /Applications/TeXmacs.app/Contents/MacOS/TeXmacs
    

Just modify the scheme related code under $HOME/texmacs/texmacs/TeXmacs, if you only change the scheme code, you do not have to compile the c++ part.

Thanks for your reply. I summarize the tricks as follows.

Locate definitions and documents of symbols and modules

  1. Enable Tools -> Developer Tool.
  2. Goto Developer -> Open module/symbol browser.

In this way, you can:

  • Browse the documentation generated from scheme code.
  • Jump to the definition of a specific function.

Modify symbols within TeXmacs

  1. Goto Insert -> Session -> Scheme to insert a scheme session.
  2. Use this to redefine or modify modules or symbols.

Develop Scheme Code without re-compiling TeXmacs (on Linux)

  1. Assuming that the whole src code is cloned at <TEXMACS_REPO_PATH>.
  2. cp the extra ice-9 directory to the source code directory.
cp -r guile/ice-9 <TEXMACS_REPO_PATH>/TeXmacs/progs
  1. Customize $TEXMACS_PATH
  • Add given content in the beginning of /usr/bin/texmacs
export TEXMACS_PATH=<TEXMACS_REPO_PATH>
export TEXMACS_BIN_PATH=/usr/lib/texmacs/TeXmacs
  1. Launch TeXmacs with repo path.
texmacs

In this way, you can launch TeXmacs with scheme code from the repo. If you want to modify scheme code, you need to re-launch TeXmacs to see whether the changes work.

1 Like

I only recently discovered the Debug->Status functions. They print useful info on the command line. Especially the Tree function has been useful.