I'm trying to write a macro and key binding to simplify the insertion of
cross references:
<command name="djf.InsertXref">
<macro>
<sequence>
<command name="insert" parameter="into xref"/>
<command name="prompt" parameter='XREF "Enter xref ID:"'/>
<command name="putAttribute" parameter="linkend %_"/>
</sequence>
</macro>
</command>
<!-- Ctrl-C R: insert a cross reference <xref> prompt for linkend. -->
<binding>
<keyPressed code="C" modifiers="ctrl"/>
<keyPressed code="R"/>
<command name="djf.InsertXref"/>
</binding>
It doesn't work. The xref gets inserted, and I get prompted for the
parameter value, but the default ??? value of the linkend attribute
never changes. Furthermore, when I execute this command the letter R is
inserted after the xref. (The second key of my key binding is just R
with no modifiers, but I've used this style of binding for other
commands without problem.)
However, if I change the binding from Ctrl-C R to Ctrl-C Ctrl-R, then it
works. My hypothesis is that somehow the insert command is broken when
bound to a key that is insertable. When the letter R gets inserted my
new xref element is no longer selected (although it does appear
selected) and the putAttribute call fails.
Anyway, it looks like a bug to me.
David