- From: Joris van der Hoeven <address@hidden>
- To: address@hidden
- Subject: Re: [TeXmacs] Macro dependent on previous character
- Date: Thu, 23 Jun 2005 10:33:28 +0200
Hi Alvaro,
On Sat, Jun 18, 2005 at 12:46:11PM +0200, Álvaro Tejero Cantero wrote:
>
> I assume that you wrote macros for bra and ket?
>
> Otherwise, you might simply select "a>" and paste it behind "<b|".
>
>
Yes, I wrote macros for them. It is the context-sensitiveness of the
>
macros that interests me, although in this case I also spare myself the
>
deletion of the trailing "|" from |a>.
The new version 1.0.5.4 comes with some more explanations on
the tree API in
Help -> Scheme extensions
In order to test whether you are behind a 'foo' macro, you may use
(and (tree-is? (cursor-tree) 'foo)
(== (cDr) (cursor-path) 1))
Testing whether you are before a 'bar' macro is a bit more complex
(I will think about a more satisfactory solution later).
On the other hand, if the 'bar' macro should be part of a 'concat',
then you should be able to use:
(and (tree-is? (cursor-tree) :up 'concat)
(tree-is? (cursor-tree) :next 'bar)
(== (cursor-path) (tree->path (cursor-tree) :end)))
Best wishes, Joris
Archive powered by MHonArc 2.6.19.