Fold-unfold macros

Giovanni Piredda <[email protected]> Thu, 16 Feb 2023 19:17:31 +0000
Newsgroups gmane.editors.texmacs.devel
Message-ID <[email protected]>
Dear all,

responding to a forum post 
(http://forum.texmacs.cn/t/unable-to-fold-back-unfold-inside-macro/1281), 
I defined two fold/unfold macros in the following way



<assign|folded-sol|<\macro|y>
<\render-folded-std|<unfold-button|<resize|<with|mode|math|<op|\<circ\>>>|||<maximum|1r|1.5fn>|>|<with|font-series|bold|solution>>>
     <with|font-series|bold|solution>

     <hidden|<arg|y>>
   </render-folded-std>
</macro>>

<assign|unfolded-sol|<\macro|y>
<\render-folded-std|<fold-button|<resize|<with|mode|math|\<bullet\>>|||<maximum|1r|1.5fn>|>|<with|font-series|bold|solution>>>
     <with|font-series|bold|solution>

     <arg|y>
   </render-folded-std>
</macro>>

together with

(define-fold folded-sol unfolded-sol)


The two macros turn into each other when pressing over the fold/unfold 
button, but the code gives the following error when unfolding (but not 
when folding):

Backtrace:
In unknown file:
    ?: 0* [#<procedure {#f} ()>]
    ?: 1* [mouse-unfold <tree <with|font-series|bold|solution>>]
In 
/home/giovanni/Downloads/TeXmacs/TeXmacs-2.1.1-x86_64-pc-linux-gnu/TeXmacs/progs/utils/edit/variants.scm:
  223: 2  (if (tree->path t) (begin (tree-go-to t #) (if # #)))
In 
/home/giovanni/Downloads/TeXmacs/TeXmacs-2.1.1-x86_64-pc-linux-gnu/TeXmacs/progs/dynamic/fold-edit.scm:
    ...
  143: 3  [players-set-elapsed {#f} 0.0]

/home/giovanni/Downloads/TeXmacs/TeXmacs-2.1.1-x86_64-pc-linux-gnu/TeXmacs/progs/dynamic/fold-edit.scm:143:7: 
In procedure players-set-elapsed in expression (players-set-elapsed 
(tree-ref t i) 0.0):
/home/giovanni/Downloads/TeXmacs/TeXmacs-2.1.1-x86_64-pc-linux-gnu/TeXmacs/progs/dynamic/fold-edit.scm:143:7: 
Wrong type argument in position 1: #f


Could someone give me a hint on what to look out for / how to correct 
the code?


Giovanni


_______________________________________________
Texmacs-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/texmacs-dev