Lisp HUG Maillist Archive

using functions from the EDITOR package

There are various useful functions documented in the EDITOR package,
like EDITOR:PROMPT-FOR-FILE &c.  Is there any way of establishing a
context other than with DEFCOMMAND where these can be used?  What I
want to do is avoid having to define all sorts of commands, but call
these things from an interactive loop.  This does not work, because
the function thinks that there is no echo area.  CALL-EDITOR is no
good (I think) because I want to pass complicated arguments.

(define-interface listener-test ()
  ()
  (:panes
   (listener
    interactive-pane
    :echo-area-pane echo-area
    :min-width '(character 80)
    :min-height '(character 15)
    :top-level-function
    #'(lambda (i p s)
        (declare (ignore i p))
        (let ((*standard-input* s)
              (*standard-output* s)
              (*error-output* s)
              (*trace-output* s)
              (*debug-io* s)
              (*query-io* s)))
        (loop for x = (editor:prompt-for-file :prompt "foo")
              do (pprint x s))))
   (echo-area echo-area-pane :max-height t))
  (:default-initargs
   :title "Gub"))

Thanks

--tim


Re: using functions from the EDITOR package

* I wrote:
> There are various useful functions documented in the EDITOR package,
> like EDITOR:PROMPT-FOR-FILE &c.  Is there any way of establishing a
> context other than with DEFCOMMAND where these can be used?  What I
> want to do is avoid having to define all sorts of commands, but call
> these things from an interactive loop.  This does not work, because
> the function thinks that there is no echo area.  CALL-EDITOR is no
> good (I think) because I want to pass complicated arguments.

It turns out that (some of) the answer seems to be a complicated
mixture of CALL-EDITOR (which will, in fact, take a function as an
argument), and EXECUTE-WITH-INTERFACE on the editor pane's interface.
CALL-EDITOR unfortunately doesn't (can't?) return the results of the
function it calls, so you can fake things up with a mailbox, and then
jump through a million hoops to try and deal with errors and user
aborts and general ick.  There just must be a better way!

--tim



Re: using functions from the EDITOR package

* Greg DuPertuis wrote:
> e.g CAPI:PROMPT-FOR-FILE ?? This what you're looking for?

No.  I use that now, but I want to use the emacs-style functions with
completion &c instead, because they're better than the horrible motif
file selection dialogue...

--tim


Updated at: 2020-12-10 09:01 UTC