Skip to Content.
Sympa Menu

texmacs-users - Re: [texmacs-users] New TeXmacs version 2.1.5

Subject: mailing-list for TeXmacs Users

List archive

Chronological Thread  
  • From: Zoltán Kovács <address@concealed>
  • To: Giovanni Piredda <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [texmacs-users] New TeXmacs version 2.1.5
  • Date: Sat, 8 Aug 2026 13:07:13 +0200

Giovanni, Liza, thanks again for the useful hints!
Meanwhile I managed to solve some of the problems (with quite big efforts, the source code of TeXmacs is still a mystery for me):

Giovanni Piredda <address@concealed> ezt írta (időpont: 2026. márc. 28., Szo, 15:21):
> 2. Do you plan to support guile-2.2 or higher? Currently I need to
> patch TeXmacs if I want to use guile-2.2 on Ubuntu 24.04 (when I want
> to build it from source, just in case).

I learned how to compile the required version of guile (https://github.com/texmacs/guile-texmacs): it is definitely a must to use an older gcc version. In my case, gcc-12 works well, fortunately it is still available on Ubuntu 26.04 too.
 
> 3. How to implement a simple syntax highlighting feature for session
> inputs for a certain language? I already spent a lot of time trying to
> figure out how it is done with Python sessions, but I could not write
> my own syntax highlighter for another language.

This is what to do:
1) Assume we want syntax highlighting for a new language, say "newlang". We need to create the folder ~/.TeXmacs/plugins/newlang/progs/ first.
2) In this folder we need to put three files: newlang-format.scm with the content
(texmacs-module (newlang-format))
(define-format newlang (:name "newlang source code"))
and another file newlang-lang.scm with the minimal example content
(texmacs-module (newlang-lang) (:use (prog default-lang)))
(tm-define (parser-feature lan key)
  (:require (and (== lan "newlang") (== key "keyword")))
  `(,(string->symbol key)
    (keyword "print" "if" "and" "other" "keywords")
    (keyword_control "more")
    (constant_module "etc"))) ;; and so on...
(define (notify-newlang-syntax var val) (syntax-read-preferences "newlang"))

and the third file init-newlang.scm with something like this:
(plugin-configure newlang
  (:require (url-exists-in-path? "newlang-cli")) ;; here newlang-cli is an interpreter (executable) for newlang
  (:launch "newlang-cli")
  (:session "newlang"))
(lazy-format (newlang-format) newlang)
This last line was crucial and it took me several months to figure out. Usually it already appears in the system-wide startup script progs/init-texmacs.scm for the already working languages like python. 
3) To enable this only for session inputs but not for session outputs and session errors, we need to create the file ~/.TeXmacs/plugins/newlang/packages/session/newlang.ts with some minimal content like 
<TeXmacs|1.99.19>

<style|source>

<\body>
  <active*|<\src-title>
    <src-package|newlang|1.0>

    <\src-purpose>
      Markup for newlang sessions.
    </src-purpose>

    <src-copyright|2026|Your Name>

    <\src-license>
      Some license
    </src-license>
  </src-title>>

  <\active*>
    <\src-comment>
      Use verbatim output
    </src-comment>
  </active*>

  <assign|newlang-output|<\macro|body>
    <\with|mode|text|language|verbatim|font-family|tt>
      <\generic-output>
        <arg|body>
      </generic-output>
    </with>
  </macro>>

  <assign|newlang-errput|<\macro|body>
    <\with|mode|text|language|verbatim|font-family|tt>
      <\generic-errput>
        <arg|body>
      </generic-errput>
    </with>
  </macro>>

  \;
</body>

<\initial>
  <\collection>
    <associate|preamble|true>
  </collection>
</initial>
I used Joris' .ts file for python with technically no modification.
4) A re-initialization of TeXmacs' settings may be required (I used the -S option on command line).

A working example can be found at https://github.com/kovzol/bibref-book. In particular, the file Dockerfile.texmacs-src builds TeXmacs from sources on Debian Trixie (after tweaking two things: allowing underscore in keywords in syntax highlighting and improving index ordering when numbers are present), improves the Hungarian translation and displays a saved TeXmacs document in an X11 window. I will provide a blog entry on this soon, but maybe the summary above is useful for some of you. Should I fork TeXmacs on GitHub, add these changes and send a pull request to make it possible to incorporate them upstream?

I am still fighting with one issue: How can I switch off showing visible spaces? TeXmacs automatically displays them in string contexts (that is, between apostrophes or quotation marks) by using the "open box" character (␣, Unicode U+2423). This is nice in many cases, but in my case it should be avoided. Any ideas?

Thanks and best regards,
Zoltán

--

Dr. Zoltán Kovács, MSc

Private Pädagogische Hochschule der Diözese Linz
https://matek.hu/zoltan




Archive powered by MHonArc 2.6.24.

Top of Page