<TeXmacs|1.99.1>

<style|<tuple|generic|framed-session|mathemagix>>

<\body>
  <\session|r|default>
    <\unfolded-io>
      \<gtr\>\ 
    <|unfolded-io>
      cat("Press enter here to start R\\n")
    <|unfolded-io>
      cat("Press enter here to start R\\n")

      Press enter here to start R
    </unfolded-io>

    <\input>
      <with|color|red|\<gtr\> >
    <|input>
      \;
    </input>
  </session>

  Sending a command to TeXmacs works:

  <\session|r|default>
    \;

    <\unfolded-io>
      <with|color|red|\<gtr\> >
    <|unfolded-io>
      cat("\\2command:(display \\"hello\\\\n\\")\\5")
    <|unfolded-io>
      cat("\\2command:(display \\"hello\\\\n\\")\\5")
    </unfolded-io>

    <\input>
      <with|color|red|\<gtr\> >
    <|input>
      \;
    </input>
  </session>

  Updating the R menu works \ once only:

  <\session|r|default>
    <\unfolded-io>
      \<gtr\>\ 
    <|unfolded-io>
      cat("\\2command:(menu-bind r-menu (\\"first\\" (display
      \\"R\\")))\\5\\n")
    <|unfolded-io>
      cat("\\2command:(menu-bind r-menu (\\"first\\" (display
      \\"R\\")))\\5\\n")

      \;
    </unfolded-io>

    <\input>
      <with|color|red|\<gtr\> >
    <|input>
      \;
    </input>
  </session>

  The second update will not update the menu. Execute it, and you'll see that
  the R menu still displays ``first''

  <\session|r|default>
    <\unfolded-io>
      <with|color|red|\<gtr\> >
    <|unfolded-io>
      cat("\\2command:(menu-bind r-menu (\\"second\\" (display
      \\"R\\")))\\5\\n")
    <|unfolded-io>
      cat("\\2command:(menu-bind r-menu (\\"second\\" (display
      \\"R\\")))\\5\\n")

      \;
    </unfolded-io>

    <\input>
      <with|color|red|\<gtr\> >
    <|input>
      \;
    </input>
  </session>

  This is what is sent to TeXmacs:

  <\session|r|default>
    <\unfolded-io>
      <with|color|red|\<gtr\> >
    <|unfolded-io>
      cat("2command:(menu-bind r-menu (\\"second\\" (display \\"R\\")))5\\n")
    <|unfolded-io>
      cat("2command:(menu-bind r-menu (\\"second\\" (display \\"R\\")))5\\n")

      2command:(menu-bind r-menu ("second" (display "R")))5
    </unfolded-io>

    <\input>
      <with|color|red|\<gtr\> >
    <|input>
      \;
    </input>
  </session>

  \;

  \;

  \;
</body>

<\references>
  <\collection>
    <associate|auto-1|<tuple|1|?>>
    <associate|auto-2|<tuple|1.1|?>>
    <associate|auto-3|<tuple|1.2|?>>
    <associate|auto-4|<tuple|1.3|?>>
    <associate|auto-5|<tuple|1.4|?>>
    <associate|auto-6|<tuple|1.5|?>>
    <associate|auto-7|<tuple|1.6|?>>
    <associate|auto-8|<tuple|1.7|?>>
  </collection>
</references>