unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using readline with Emacs shell or eshell or ???
@ 2003-04-29  4:03 Robert L. Knighten
  2003-04-29  5:31 ` John W. Eaton
  0 siblings, 1 reply; 5+ messages in thread
From: Robert L. Knighten @ 2003-04-29  4:03 UTC (permalink / raw)


I am writing a command line program in which I want to have command line
editing, command and argument completion, history, etc.  The GNU Readline
package does this quite nicely, BUT my users will often actually want to
invoke the program inside the Emacs shell or perhaps eshell.  Of course
command line editing works just fine, but command and argument completion are
lost.  What is the best way of working around this?

I'm prepared to write some substantial elisp if that is the way to go.  But I
hope there is something already done.

-- Bob

-- 
Robert L. Knighten
Robert@Knighten.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using readline with Emacs shell or eshell or ???
  2003-04-29  4:03 Using readline with Emacs shell or eshell or ??? Robert L. Knighten
@ 2003-04-29  5:31 ` John W. Eaton
  2003-04-30 22:52   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: John W. Eaton @ 2003-04-29  5:31 UTC (permalink / raw)


Robert@Knighten.org (Robert L. Knighten) writes:

> I am writing a command line program in which I want to have command line
> editing, command and argument completion, history, etc.  The GNU Readline
> package does this quite nicely, BUT my users will often actually want to
> invoke the program inside the Emacs shell or perhaps eshell.  Of course
> command line editing works just fine, but command and argument completion are
> lost.  What is the best way of working around this?
> 
> I'm prepared to write some substantial elisp if that is the way to go.  But I
> hope there is something already done.

For an example that works (but might not be the best implementation)
take a look at the inferior-octave-complete function in the Emacs mode
for running Octave inside Emacs (octave-inf.el).  The Emacs function
for completion sends a command to Octave to generate completions and
then displays them.  It uses comint for some of the ugly stuff, so the
amount of Lisp code specific to the Octave mode is relatively small.
If you can make it smaller and cleaner, I'd be interested in patches.

jwe

-- 
www.octave.org        | Unfortunately we were hopelessly optimistic in 1954
www.che.wisc.edu/~jwe | about the problems of debugging FORTRAN programs.
                      |                                       -- J. Backus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using readline with Emacs shell or eshell or ???
  2003-04-29  5:31 ` John W. Eaton
@ 2003-04-30 22:52   ` Stefan Monnier
  2003-04-30 23:23     ` Ilya Zakharevich
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2003-04-30 22:52 UTC (permalink / raw)


> For an example that works (but might not be the best implementation)
> take a look at the inferior-octave-complete function in the Emacs mode
> for running Octave inside Emacs (octave-inf.el).  The Emacs function
> for completion sends a command to Octave to generate completions and
> then displays them.  It uses comint for some of the ugly stuff, so the

I haven't looked at how octave-inf.el does it, but gud.el does it
as well when interacting with gdb, so you can also look at that
one.  If you look at both and get some insight, I'd like to
hear about it.


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using readline with Emacs shell or eshell or ???
  2003-04-30 22:52   ` Stefan Monnier
@ 2003-04-30 23:23     ` Ilya Zakharevich
  2003-05-02  6:45       ` Robert L. Knighten
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Zakharevich @ 2003-04-30 23:23 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Stefan Monnier
<monnier+gnu.emacs.help/news/@flint.cs.yale.edu>], who wrote in article <5lhe8fion1.fsf@rum.cs.yale.edu>:
> > For an example that works (but might not be the best implementation)
> > take a look at the inferior-octave-complete function in the Emacs mode
> > for running Octave inside Emacs (octave-inf.el).  The Emacs function
> > for completion sends a command to Octave to generate completions and
> > then displays them.  It uses comint for some of the ugly stuff, so the
> 
> I haven't looked at how octave-inf.el does it, but gud.el does it
> as well when interacting with gdb, so you can also look at that
> one.  If you look at both and get some insight, I'd like to
> hear about it.

IIRC, gdb has "complete" command.  GUD erases the current line, sends
the complete command, processes the output, then restores the current
line and acts on the completion list.

Do not think one can do anything with a random non-cooperating program.

Hope this helps,
Ilya

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using readline with Emacs shell or eshell or ???
  2003-04-30 23:23     ` Ilya Zakharevich
@ 2003-05-02  6:45       ` Robert L. Knighten
  0 siblings, 0 replies; 5+ messages in thread
From: Robert L. Knighten @ 2003-05-02  6:45 UTC (permalink / raw)


Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

> [A complimentary Cc of this posting was sent to
> Stefan Monnier
> <monnier+gnu.emacs.help/news/@flint.cs.yale.edu>], who wrote in article <5lhe8fion1.fsf@rum.cs.yale.edu>:
> > > For an example that works (but might not be the best implementation)
> > > take a look at the inferior-octave-complete function in the Emacs mode
> > > for running Octave inside Emacs (octave-inf.el).  The Emacs function
> > > for completion sends a command to Octave to generate completions and
> > > then displays them.  It uses comint for some of the ugly stuff, so the
> > 
> > I haven't looked at how octave-inf.el does it, but gud.el does it
> > as well when interacting with gdb, so you can also look at that
> > one.  If you look at both and get some insight, I'd like to
> > hear about it.
> 
> IIRC, gdb has "complete" command.  GUD erases the current line, sends
> the complete command, processes the output, then restores the current
> line and acts on the completion list.
> 
> Do not think one can do anything with a random non-cooperating program.
> 
> Hope this helps,
> Ilya
> 
gud was the first thing I looked at, but as noted it is based on a really
tight interaction with the debugger and is very complex as a result.

I'v now played with octave-inf.el and even it is overkill for the rather
simple program that I am building.  But it is very clean and it appears that
it will serve as an excellent base for what I do need.

Thank you for the comments.

-- Bob

-- 
Robert L. Knighten
Robert@Knighten.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-02  6:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-29  4:03 Using readline with Emacs shell or eshell or ??? Robert L. Knighten
2003-04-29  5:31 ` John W. Eaton
2003-04-30 22:52   ` Stefan Monnier
2003-04-30 23:23     ` Ilya Zakharevich
2003-05-02  6:45       ` Robert L. Knighten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).