[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] New special env variable: path to self

From: Henri Lesourd
Subject: Re: [Texmacs-dev] New special env variable: path to self
Date: Thu, 23 Nov 2006 15:10:19 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821

Lionel Elie Mamane wrote:

I did some further testing and it seems that this works in normal

circumstances only if the parameter is a string tree and not a
compound tree (such as a concat).

No, this is not the real root cause of your problem : the root
cause is that if the trees you get as an input of your macro
are **expanded** trees, by their very nature they **cannot**
be part of the document, and therefore they have no meaningful

On the other hand, the solution with
my patch seems to work in some cases where (tree->path) does not and
not to work in some cases where (tree->path) does work. And adding an
_empty_ argument just for path-tracking sake seems to do as well as my
patch. I don't completely understand what's going on.

Let me describe exactly what I do:

My style files have:


and the scheme function show-path is:

(tm-define (show-path t t0 s p)
 (:secure #t)
 (display "show-path ")(write (tree->path t))(newline)
 (write (tree->path t0))(newline)
 (write (decode-self-path s))(newline)
 (write (tree->path p))
 (list 'coq-orig-input t t0))

I remind you that "decode-self-path" and <value|self-path> are
introduced by my patch.

Forget it, there are much simpler ways to do it, provided you remember
the difference between expanded and non-expanded markup, and that
only the latter kind can be referred directly from Scheme via a simple
pointer (and therefore, have a real path pointing it from the root of
the buffer tree).

You see?
Have a look at the attached .tm file, and tell me if you can
still trick it the way you did in the examples of your previous
mail (i.e., try to interactively change the parameter of
the two instances of the <self-path*|...> macros in the
document). I guess that as far as the <self-path|...> macro
is concerned, you can't trick it anymore, now ;-).

Best, Henri


  1/ Validate the (my-scheme-macro) definition below

    <\input|scheme] >
      (tm-define (my-scheme-macro parm)

      \ \ \ (:type (tree -\<gtr\> tree))

      \ \ \ (with path (tree-\<gtr\>path parm)

      \ \ \ \ \ \ (display* "\\nparm(" path ")=" parm "\\n"))

      \ \ \ '(arg "x"))

      (100 (tree -\<gtr\> tree))

    <\input|scheme] >

  . and then, activate the markup by means of
  Document-\<gtr\>View-\<gtr\>Edit source tree.


  2/ You can have a look at the code of the two macros
  \<less\>self-path-buggy\<gtr\> and \<less\>self-path\<gtr\> below, the
  trick is not to forget using \<less\>quote-arg\<gtr\>, and it seems it
  works with this (to clearly see the difference do a go and comeback to
  Document-\<gtr\>View-\<gtr\>Edit source tree).



  <self-path-buggy|<block|<tformat|<table|<row|<cell|<underline|abcde (the
  buggy one : observe that the markup is expanded)>>>>>>>



  <self-path|<block|<tformat|<table|<row|<cell|<underline|abcde> (the right
  one : observe that the markup is non-expanded)>>>>>>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]