danysdragons / visual-cells

Display Lisp S-exp as tree of cons cells in a cario surface(pdf+ png).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

visual-cells

Display Lisp S-exp as tree of cons cells in a cario surface(pdf+png).

Quick Guide

Download File 'src/visual-cells.lisp' in this repository. put it in current directory.
Load 'visual-cells.lisp' to your lisp image. For example :

  (load "visual-cells.lisp")
  (visual-cells:fvs '((a . 1) (b . 2) (c . 3)) "alist")

alist.png
alist.png

Call visual-cells in Slime

Add following line to your common lisp startup script. (eg. ~/.sbclrc)

    (load "/path-to/visual-cells.lisp") ; Change "/path-to/" to your directory.

Add following lines to your emacs startup file.(eg. ~/.emacs)

;; function to call by emacs
(defun visual-exp ()
  (interactive)
  (slime-eval `(swank:eval-and-grab-output
		,(concat "(visual-cells::fvs '"
			 (slime-last-expression)
			 "\"/tmp/vs.out\")")))
  (let* ((o-buffer-name "*visual-cells-output*")
	 (o-buffer (get-buffer o-buffer-name)))
    (when o-buffer (kill-buffer o-buffer))
    (find-file-read-only-other-window "/tmp/vs.out.png")
    (rename-buffer "*visual-cells-output*")))
;; set key binding for slime mode
(global-auto-revert-mode 1)
(add-hook 'slime-mode-hook
	  '(lambda ()
	     (define-key slime-mode-map "\C-cv" 'visual-exp)))

Start your Emacs and run slime, Open a lisp file.
Move the point to end of a s-expresion, press "Ctrl+C V", the graphical display of the s-expression will open in Eamcs .
slime-screenshot.png

Todo

Specific topology and style for more Lisp data type, such as Hash, Alist, Plist etc.

About

Display Lisp S-exp as tree of cons cells in a cario surface(pdf+ png).


Languages

Language:Common Lisp 91.7%Language:Emacs Lisp 8.3%