programmatically closing editor window
I have a graphical app that opens text editor windows to edit text. What is the preferred way to write a defcommand that will call my save routine then close (destroy) the one window from which the command was keystroke-invoked? I've tried: [1] (editor:defcommand "Save Text Atom" (p) (declare (ignore p)) (let ((intf (gethash (editor:current-buffer) *buffer-to-intf*))) (when intf (save-contents nil intf) (capi:destroy (get-top-interface intf))))) <<<< [2] (editor:defcommand "Save Text Atom" (p) (declare (ignore p)) (let ((intf (gethash (editor:current-buffer) *buffer-to-intf*))) (when intf (save-contents nil intf) (editor:delete-window-command)))) <<<<<< Version [1] works sometimes, but after a few calls, leaves a hung editor window which cannot be closed by any means (other than shutting LWL down). [This seems to imply that I've caused a race condition by mistreating LWL]. Version [2] leaves an empty editor window behind (at least on LWL) then brings to the front any other editor window (like my lisp text editor), obscuring the graphical app (annoying). If I attach "save-command" to the :destroy-callback of the edit window, I get the desired behaviour, except that the UI gesture is clumsy (move hands from keyboard to mouse) - I want to mimic that behaviour from a single keystroke. [What I really want is an in-place text-edit widget, but I don't believe that that exists, so I'm using a pop-up, pop-down editor]. thanx pt