tbray@watsol.waterloo.edu (Tim Bray) (01/04/88)
It occurs to me that it should be pretty easy to cook up an SGML structured text editing facility using GNU emacs. Before I start - has anyone done or thought about this? Tim Bray, New Oxford English Dictionary Project, U of Waterloo, Ontario
wcs@ho95e.ATT.COM (Bill.Stewart) (01/04/88)
>It occurs to me that it should be pretty easy to cook up an SGML structured >text editing facility using GNU emacs. Before I start - has anyone done or >thought about this? >Tim Bray, New Oxford English Dictionary Project, U of Waterloo, Ontario I've thought about a similar problem, which is outline processors, for which SGML is a natural match. Part of the job should be pretty easy, but parts of it are ~impossible. SGML lets you describe a document using a BNF-like grammar, e.g. <Document> ::= <header> <section-level-1> [ <section-level-1> .... ] <section-level-1> ::= <level-1-header> <section-lev-2> <section-level-1> ::= <level-1-header> <paragraph> etc. An actual document will have the various pieces delimited by gen-tags, and you'll have a parser that breaks up the document into its components, and typically a text formatter associated with the parser (a la Scribe). Emacs is a WYSIWYG intelligent editor. It shouldn't be difficult to convince emacs to help you input the document, as long as you don't mind the tags showing. You can define macros to do things like: expand a <section-level-1> tag into it's components (easy) expand a whatever-tag-you're-on tag into components (harder) automagically indent <level-3-headers> 2 spaces, in italics. The harder tasks, which are critical for an outline processor, are remember there's a tag here, but don't display it, and display the <section-lev-2> tag but don't display the body. The problem is that those two require EMACS to stop being WYSIWYG, and I've never seen a way to do that (I haven't used GNUmacs, but I assume that hasn't changed; it's pretty fundamental to the design). Adding this capability would be a big step up in the usefulness of EMACS for non-programming tasks. I suppose the simplest approach is to define a section as "invisible", with some kind of magic cookie, possibly occupying a screen location (yuk). It may not be much tougher than adding the capability to display underlined/boldfaced text? The intermediate-toughness tasks I can see are get emacs to understand a set of BNF definitions, instead of wiring them in provide a clean mechanism for dealing with objects (pattern-search for gen-tags is crude, but will usually do, depending on your grammar. At minimum, you should be able to define more than one mark.) -- # Thanks; # Bill Stewart, AT&T Bell Labs 2G218, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs