[climacs-devel] Can syntax classes handle text overlays? (Evaluating from buffer)

Robert Strandh strandh at labri.fr
Thu Aug 25 04:34:46 UTC 2005


Hello, 

Derek Peschel writes:
 > 
 > I know that display-parse-tree gets called for every node in the tree.

Sort of.  It gets called for every parse tree that is at least
partially on display in a window. 

 > Can that handle anything like Emacs's text properties or overlays?
 > In the most general case, they apply to characters and not parse-tree items,
 > so the character-by-character formatting of the overlay would have to be
 > mixed with the formatting of the parse item.

If you do want overlays, you probably would have to do essentially
what emacs does, as a mechanism separate from that of displaying parse
trees. 

You could also exploit the fact that a Climacs buffer can contain any
Common Lisp object.  You could for instance convert a sequence of
characters to an object of type S-expression and then have a PRESENT
method on it that makes it display in a different way. 

 > Right now, the only thing on the screen that has X-Y coordinates derived
 > from a text location seems to be the cursor.  And I've edited LISP files
 > with strings (displayed in a larger italic font) and the cursor can go to
 > the wrong place in the window, so I suspect the syntax machinery is not
 > being used.

Right, the way the position of the cursor is currently computed is
bogus.

 > Ultimately I'm dreaming of an evaluation package that would replace the
 > teletype mentality of the traditional top-level loop.  With my package,
 > the user would highlight text to act on (evaluate, macro expand, etc.),
 > either using unstructured commands (move by character and line) or
 > structured ones (mark defun around point).  The results might be substituted
 > for the original text or the package might keep a history of the computation.
 > I can't decide much more about the design until I have a prototype.  (I tried
 > a few experiments with Emacs and its structured navigation functions are
 > far too inaccurate to be useful.)

For the structured part, you could highlight a parse tree (say) by
entering it in a hash table of parse trees to be highlighted in
particular ways, and then use an :around method to turn on and off
highlighting.  Clicking on some text could select that parse tree, or
you could use specific commands for that. 

For the unstructured commands, I am not sure.  It seems to me like you
might want to indicate a certain parse tree by putting point there,
but you probably would not want arbitrary sequences of characters to
be selected.  At least not in this particular application. 
-- 
Robert Strandh

---------------------------------------------------------------------
Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
---------------------------------------------------------------------



More information about the climacs-devel mailing list