texmacs-dev
[Top][All Lists]
Advanced

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

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


From: Lionel Elie Mamane
Subject: Re: [Texmacs-dev] New special env variable: path to self
Date: Thu, 23 Nov 2006 21:18:32 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Thu, Nov 23, 2006 at 08:18:02PM +0100, Henri Lesourd wrote:
> Lionel Elie Mamane wrote:

>> It does have the disadvantage of variable capture, namely the "x" is

>> hardcoded in the Scheme function. I tried to return:

>> parm
>> (list 'unquote parm)
>> (list 'eval parm)

> This will not work, the Scheme unquote, eval, and
> the like have absolutely no connection to the corresponding
> ones in the macro-expander.

These are not the Scheme unquote and eval, but strees (thus TeXmacs
documents) whose label is unquote and eval. It didn't seem too far
fetched that the TeXmacs macro-expander unquote would turn the result
of <quote-arg|x> in the result of <arg|x>, or that an extra round of
evaluation would do that.

>> instead, but this breaks interactive editing: e.g. typing '^' in math
>> mode doesn't make a superscript anymore, but a '^' character.

> This happens only if you edit the parameter in the version of
> the macro without <quote-arg|...> (for some reason I don't fully
> understand, to be honest...).

As far as I can test, even with quote-arg, it happens if you return
your parameter, or anything based on your parameter.

I tried all combinations of

(tm-define (foo t)
  (:secure #t)
  t)

(tm-define (foo t)
  (:secure #t)
  (texmacs-exec t))

(tm-define (foo t)
  (:secure #t)
  (list 'eval t))

(tm-define (foo t)
  (:secure #t)
  (list 'unquote t))

and

<assign|foo|<macro|x|<extern|foo|<quote-arg|x>>>>

<assign|foo|<macro|x|<extern|foo|<arg|x>>>>

interactive edit is broken with all of these 8 things. So for now,
the:

(tm-define (foo t v)
  (:secure #t)
  (list 'arg v))

<assign|foo|<macro|x|<extern|foo|<quote-arg|x>|x>>>

although a bit ugly works best. Thanks for all the information!

> If you want to call the macro-expander from inside Scheme,
> use (texmacs-exec x). For example, you could try :
> <<
> (tree->stree (texmacs-exec '(underline "abcde")))
> >>

Ah, it is called texmacs-exec. Thanks.

-- 
Lionel




reply via email to

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