Skip to content

Instantly share code, notes, and snippets.

View lokedhs's full-sized avatar

Elias Mårtenson lokedhs

View GitHub Profile
(clim:define-command-table maxima-commands
:inherit-from (maxima-client.markup:text-commands
expression-commands
maxima-client.workbench:workbench-commands
watcher-commands
maxima-client.canvas:canvas-commands))
(clim:define-command (plot2d-with-range :name "Plot 2D" :menu t :command-table maxima-commands)
((expression maxima-native-expr :prompt "Expression")
(variable maxima-native-expr :prompt "Variable")
(clim:make-command-table 'maxima-plot-command-table
:errorp nil
:menu '(("Discrete" :command `(plot2d-with-range
,clim:*unsupplied-argument-marker*
,clim:*unsupplied-argument-marker*
,clim:*unsupplied-argument-marker*
,clim:*unsupplied-argument-marker*))
("Parametric" :command plot2d-with-range)
("Plot example" :command plot2d-demo)))
;;; Does not work
(let ((rec (clim:with-output-to-output-record (pane 'canvas-object-record-inner)
(draw-canvas-object pane obj))))
(clim:stream-add-output-record pane rec))
;;;; Works
(clim:with-new-output-record (pane 'canvas-object-record-inner)
(draw-canvas-object pane obj))
#|
Here's the problem:
When the panel is initially created, all graphics are drawn correctly. In this simplified example
this means that there are two lines being drawn.
Next, I type a command in the interactor, which results in the REPAINT-ALL function being called again.
On the screen, only one of the lines is now drawn. The second one (the one inside the inner output record)
is inivisible, but I can make it appear by calling CLIM:REPAINT-SHEET.
|#
∇ wrapBox (v) {
w ← (⍴v)[1]
{((⊂"┏") , (w ⍴ ⊂"━") , ⊂"┓"),[0]⍵,[0](⊂"┗") , (w ⍴ ⊂"━") , ⊂"┛"} (⊂"┃") , v , ⊂"┃"
}
∇ render2d (v) {
w ← ((⍴v) ⍴ ⌈/[0] {(⍴⍵)[1]}¨v) {((↑⍴⍵) (⍺-(⍴⍵)[1]) ⍴ (⊂" ")),⍵}¨ v
wrapBox ⊃ ,[0]/ {⍺,(⊂" "),⍵}/ (⍉ (⍴w) ⍴ ⌈/[1] {↑⍴⍵}¨w) {⍵ ,[0] ((⍺-↑⍴⍵) ((⍴⍵)[1])) ⍴ (⊂" ")}¨w
}
There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION CLIM:STREAM-OUTPUT-HISTORY (2)>
when called with arguments
(#<CLIM-CLX::CLX-5942-TOP-LEVEL-SHEET-PANE MAXIMA-CLIENT::MAXIMA-MAIN-FRAME {10202AD663}>).
Found in translators.lisp. The error is raised in the call to STREAM-OUTPUT-HISTORY below:
(defun find-innermost-applicable-presentation
(input-context window x y
&key (frame *application-frame*)
There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION CLIM-INTERNALS::%INVALIDATE-CACHED-DEVICE-REGIONS (1)>
when called with arguments
(#<CLIM-INTERNALS::MIRRORED-PIXMAP {100AA776C3}>).
[Condition of type SB-PCL::NO-APPLICABLE-METHOD-ERROR]
See also:
Common Lisp Hyperspec, 7.6.6 [:section]
Restarts:
0: [RETRY] Retry calling the generic function.
(defun foo ()
(let* ((line (make-instance 'cluffer-standard-line:line))
(buf (make-instance 'cluffer-standard-buffer:buffer :initial-line line))
(cursor (make-instance 'cluffer-standard-line:right-sticky-cursor)))
(cluffer:attach-cursor cursor line)
(cluffer:insert-item cursor "foo")
(cluffer:insert-item cursor "bar")
buf))
#| Output:
(defun em-spacing-predicates (endp delimiter)
(not (or (and (eql ?\( delimiter)
(eql ?\@ (char-before (point))))
(and (eql ?\" delimiter)
(eql ?\p (char-before (point)))
(eql ?\# (char-before (1- (point))))))))
(setq paredit-space-for-delimiter-predicates '(em-spacing-predicates))
(defpackage :polygon-triangles
(:use :cl)
(:export #:open-foo-frame))
(in-package :polygon-triangles)
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (find-package "CLIM")
(sb-ext:restrict-compiler-policy 'safety 3)
(sb-ext:restrict-compiler-policy 'debug 3)