#+TITLE: Back-of-envelope-logos
#+author: screwlisp
I'm adding a detailed appendix about how to run this at the end.
UPDATE: Two small changes to help M-x org-babel-execute-buffer.
Note that you really have to start slime similar to the appendix.
Actually, just (in-package :clim-user) in slime manually please.
* clim lisp
** Have a clim2 app at all.
#+begin_src lisp
(define-application-frame logos () ())
(find-application-frame 'logos)
#+end_src
** Look at that (default application)
#+name: run-frame
#+begin_src lisp
(defvar *logos* (make-application-frame 'logos))
(run-frame-top-level *logos*)
#+end_src
#+RESULTS: run-frame
: NIL
#+RESULTS:
: #<LOGOS {10099AC083}>
Beneath the hood: I've actually set us in the CLIM-USER namespace.
** Menu with open, clear and exit
*** DONE Open (unimplemented)
[adding an open button was a homework topic for my friend,
see replay later]
#+begin_src lisp
(define-logos-command (com-open :menu t) ()
())
#+end_src
#+RESULTS:
: COM-OPEN
*** DONE Clear
We clear the display pane. It's a bit abnormal to clear the interactor (just scroll down?) so that would be done in a not-otherwise-generalisable way (using the ==editor== tools).
#+begin_src lisp
(define-logos-command (com-clear :menu t) ()
(let ((pane (get-frame-pane *application-frame* 'display)))
(window-clear pane)))
#+end_src
#+RESULTS:
: COM-CLEAR
Can just C-c C-c on this line to run it again:
#+call: run-frame()
*** Load a prev file.
#+begin_src lisp
(define-logos-command (com-replay :menu t) ((fil 'pathname :default #p"logos.txt" :display-default t))
(with-open-file (in fil :direction :input)
(loop for command = (read in nil nil)
while command do
(execute-frame-command *application-frame* command))))
#+end_src
#+RESULTS:
: COM-REPLAY
*** Remove deprecated commands
#+begin_src lisp
(let ((table (find-command-table 'logos)))
;;(remove-command-from-command-table 'com-encircle table )
(remove-command-from-command-table 'com-open table ))
#+end_src
- Encircle was just an example on a different redraw type
- open was replaced by ==com-redraw==
** ISSUES
- recorded commands are in time-reversed order
- I dunno, use your imagination.
- :display-after-commands is ~deprecated
* Running This File :appendix:
This might seem like a lot, but it amounts to "have emacs, sbcl and McCLIM on your computer"
** Emacs, slime, lisp, sbcl, quicklisp, mcclim
1. Use quicklisp (quicklisp.org) to ==(ql:quickload :mcclim)==
2. Install slime-mode in emacs (melpa.org ?)
3. I start slime like this:
#+name: clim-sbcl-start
#+begin_src elisp :eval yes
#+end_src
followed by M-x slime-connect ret ret. Good luck/ask me for more specific help.
** That's all done:
1. Open the orgfile in emacs in a graphical environment.
2. M-x customize-variable org-babel-load-languages -> INS lisp and apply-and-save
(ask me or your local emacs wizard)
3. Now you can run code blocks/CALLs from this file using C-c C-c
to run where the cursor is
a. Or the whole file in order with M-x org-babel-execute-buffer