[Python-Dev] Python 1.7 tokenization feature request

Paul Prescod paul@prescod.net
Mon, 13 Mar 2000 15:43:48 -0800


You should use your entities in the XML files, and then whatever
application actually launches Python (PMZ, your make engine, XMetaL)
could decode the data and launch Python. 
This is already how it works in XMetaL. I've just reinstalled recently
so I don't have my macro file. Therefore, please excuse the Javascript
(not Python) example.

<MACRO name="Revert To Saved" lang="JScript" id="90" 
desc="Opens last saved version of the current document">
<![CDATA[
if (!ActiveDocument.Saved) {
  retVal = Application.Confirm("If you continue you will lose changes to
this document.\nDo you want to revert to the last-saved version?");
  if (retVal) {
    ActiveDocument.Reload();
  }
}
]]></MACRO> 
 
This is in "journalist.mcr" in the "Macros" folder of XMetaL. This
already works fine for Python. You change lang="Python" and thanks to
the benevalence of Bill Gates and the hard work of Mark Hammond, you can
use Python for XMetaL macros. It doesn't work perfectly: exceptions
crash XMetaL, last I tried.

As long as you don't make mistakes, everything works nicely. :) You can
write XMetaL macros in Python and the whole thing is stored as XML.
Still, XMetaL is not very friendly as a Python editor. It doesn't have
nice whitespace handling!

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Out of timber so crooked as that which man is made nothing entirely
straight can be built. - Immanuel Kant