From: Stefan Scholl
Subject: CMUCL: Other editor for (ed)?
Date: 
Message-ID: <slrn9gs7en.7qs.stesch@parsec.no-spoon.de>
hemlock isn't very practical for me. Is there a way to configure
another editor for (ed)?

I'd like to use vim.
From: Pierre R. Mai
Subject: Re: CMUCL: Other editor for (ed)?
Date: 
Message-ID: <871ypc45xz.fsf@orion.bln.pmsf.de>
······@no-spoon.de (Stefan Scholl) writes:

> hemlock isn't very practical for me. Is there a way to configure
> another editor for (ed)?
> 
> I'd like to use vim.

You could, instead of loading hemlock, define ed to start vim in some
form.  But, since even with hemlock ed's function of editing a
function by name (e.g. (ed 'myfun)) is broken, the only thing you
could do with such an ed function would be to invoke vim with a file
you pass to ed, or empty.  It seems to me that suspending CMU CL and
starting vim by hand isn't going to be any worse.  Or if you keep a
separate vim running in another window/screen/virtual terminal, you
can just use it side-by-side with CMU CL, and re-load modified files
either by hand, or by the use of one of the defsystem's out there
(e.g. MK-DEFSYSTEM), more or less automatically.

BTW:  Most people using CMU CL don't use it with Hemlock (which has
aged quite a bit, which is no wonder, given that it's nearly 20 years
old, and hasn't received much maintenance in the past 8-10 years), but
rather use (X)Emacs and the ILISP package, which lets CMU CL run as an
sub-process, providing a fairly well-integrated editing and
interaction environment.

In any case, you could define an ed function like this:

(defun ed (&optional x)
  (unless (typep x '(or null pathname string))
    (error "Editing function definitions by name is not implemented."))
  (ext:run-program "vim"
                   (list* "-g" "-f" "-l" "--" (when x (list (namestring x))))
                   :wait t :input nil :output t :error t)
  nil)

This assumes you have a vim implementation with GUI support compiled
in.  If you don't, then you'll have to use xterm or something similar
to start vim, since running vim on the same terminal as CMU CL
involves more Unix hackery (process groups, tty owner, etc.) than I'm
prepared to do on a saturday afternoon.  The xterm version would be:

(defun ed (&optional x)
  (unless (typep x '(or null pathname string))
    (error "Editing function definitions by name is not implemented."))
  (ext:run-program "xterm"
                   (list* "-e" "vim" "-l" "--" (when x (list (namestring x))))
                   :wait t :input nil :output t :error t)
  nil)

Regs, Pierre.

-- 
Pierre R. Mai <····@acm.org>                    http://www.pmsf.de/pmai/
 The most likely way for the world to be destroyed, most experts agree,
 is by accident. That's where we come in; we're computer professionals.
 We cause accidents.                           -- Nathaniel Borenstein