lispnik / iup

Common Lisp CFFI bindings to the IUP Portable User Interface library (pre-ALPHA)
Other
139 stars 7 forks source link

Sometimes we can't cancel (C-c C-c) the IUP loop #53

Open vindarel opened 4 years ago

vindarel commented 4 years ago

I am exploring these bindings, and as a beginner I'll make errors. One of them is to call the main-loop at the wrong place, which leaves me to a state where I loose control over Slime. I can't C-c C-c the running IUP process:

(defun bookslist ()
  (iup:with-iup ()
    (let* ((frame (iup:frame
                   (iup:vbox (loop for list in (list (iup:list :value 1 :tip "List 1" :multiple :yes)
                                                     (iup:list :value 2 :tip "list 2" :dropdown :yes)
                                                     (iup:list :value 3 :tip "List 3" :editbox :yes))
                                do (loop for i from 1 upto 3
                                      do (setf (iup:attribute list i)
                                               (format nil "Item ~A" i)))
                                collect list))
                   :title "IUP List"))
           (dialog (iup:dialog frame :menu "menu" :title "a title")))
      (iup:map dialog)
      (iup:show dialog)
      ;; (iup:main-loop)
      )))

(defun main ()
  #-sbcl (hello)
  #+sbcl
  (sb-int:with-float-traps-masked
      (:divide-by-zero :invalid)
    (bookslist)
    (iup:main-loop)))

Leaves me in:

IUP> (main)

[no C-c C-c here]

I only escape from there by restarting the lisp process :/

SBCL 1.4.5

lispnik commented 4 years ago

As a work around, try running (iup:exit-loop) in a another thread, e.g. the inferior lisp buffer in slime/sly.

vindarel commented 4 years ago

Curious, but it works. When I enter this on the *inferior-lisp* buffer and press enter, I have no prompt, but it does give me control back to the Slime REPL.