[climacs-devel] Neat hack exploiting `token-to-object' and CLIM presentation types.

Troels Henriksen athas at sigkill.dk
Tue May 16 21:53:55 UTC 2006


The following hack will wrap each display of a form-token in Lisp
syntax in a `with-output-as-presentation' form that `present's it as
an expression. Also, it will define a presentation translator, so a
single click enables evaluation of the form:

(in-package :climacs-lisp-syntax)

(defmethod display-parse-tree :around ((parse-symbol form) syntax pane)
  (let ((obj (token-to-object syntax parse-symbol :no-error t)))
    (if obj
        (with-output-as-presentation (pane obj 'expression)
          (call-next-method))
        (call-next-method))))

(define-presentation-to-command-translator evaluate-expression
    (expression climacs-gui::com-eval-expression lisp-table)
    (object)
    (list object nil))

This hack is obviously quite inefficient, but I think something like
this, ie. presenting the contents of Lisp buffers as true objects, has
potential. Do you think it is a good idea? If so, how should it be
implemented?

-- 
\  Troels "Athas" Henriksen
/\ - Insert witty signature



More information about the climacs-devel mailing list