A command line feature - operate and get next history line

16 views
Skip to first unread message

Kwankyu

unread,
May 28, 2009, 8:03:42 PM5/28/09
to sage-devel
Hi,

I got a reply from GNU readline maintainer Chet Ramey to the following
wish letter.
---------------
Dear Readline Maintainer,

I am a user of Sage, a computer algebra system relying on GNU readline
library. In Sage FAQ, you can find the following article. (Magma is
another computer algebra system relying on "readline" via IPython)
1. Why is Sage's command history different than Magma's

* QUESTION: Using Sage, I am missing a feature of Magma command
line interface. In Magma, if I enter a line found in history using up
arrow key, and then press down arrow key, then the next line in
history is fetched. This feature allows me to fetch as many successive
lines in history as like. Does Sage(or readline) have a similar
feature?

* ANSWER: No, Sage does not have a similar feature. The IPython
command prompt uses the readline library (via pyreadline), which
evidently doesn't support this feature. Magma has its own custom
"readline-like" library, which does support this feature. (Since so
many people have requested this feature, if anybody can figure out how
to implement it, then such an implementation would certainly be
welcome!)

It seems that the only way Sage can have the convenient feature is
that GNU readline library have such a feature in its history facility.
I wish this happens in the new version of the GNU readline library.
Thank you for your attention. Have a nice day.
----------


From Chet Ramey:
----------
The answer is that this is very similar to the operate-and-get-next
feature
bash adds to the readline interface. I am not inclined to add this to
readline in its current form because it manipulates state managed by
the
calling application (rl_startup_hook) and requires that state to be
kept
between calls to readline(). It's a feature that should be provided
by the
calling application -- it's implementation is not complicated.
----------


Kwankyu

Jason Grout

unread,
May 28, 2009, 8:13:46 PM5/28/09
to sage-...@googlegroups.com
Kwankyu wrote:
> Hi,
>
> I got a reply from GNU readline maintainer Chet Ramey to the following
> wish letter.

Thanks for following up on this. So here's a post by Fernando (the
ipython guy) about the issue:

http://mail.scipy.org/pipermail/ipython-user/2008-June/005465.html

It seems like pyreadline is the next place to ask for this feature.

Jason

Kwankyu

unread,
May 28, 2009, 9:47:58 PM5/28/09
to sage-devel

On May 29, 9:13 am, Jason Grout <jason-s...@creativetrax.com> wrote:
> Kwankyu wrote:
> > Hi,
>
> > I got a reply from GNU readline maintainer Chet Ramey to the following
> > wish letter.
>
> Thanks for following up on this.  So here's a post by Fernando (the
> ipython guy) about the issue:
>
> http://mail.scipy.org/pipermail/ipython-user/2008-June/005465.html
>
> It seems like pyreadline is the next place to ask for this feature.
>
> Jason
>

It seems to me that the next place to ask for this feature is IPython
if pyreadline is an equivalent to GNU readline.

Kwankyu

William Stein

unread,
Jun 2, 2009, 3:04:50 AM6/2/09
to sage-devel
---------- Forwarded message ----------
From: Fernando Perez <Fernand...@berkeley.edu>
Date: Mon, Jun 1, 2009 at 11:31 PM
Subject: Re: [sage-devel] A command line feature - operate and get
next history line
To: William Stein <wst...@gmail.com>


Hi William,

On Thu, May 28, 2009 at 5:07 PM, William Stein <wst...@gmail.com> wrote:


> ---------- Forwarded message ----------
> From: Kwankyu <ekwa...@gmail.com>
> Date: Thu, May 28, 2009 at 5:03 PM
> Subject: [sage-devel] A command line feature - operate and get next history line
> To: sage-devel <sage-...@googlegroups.com>
>
>
>
> Hi,
>
> I got a reply from GNU readline maintainer Chet Ramey to the following
> wish letter.

[...]

I looked into it a little and at least Python readline does expose the
hook that appears to be necessary.  I made a ticket for it, feel free
to add any extra info that may be useful to potential implementers
(I've never used magma, so I may be missing exactly how the desired
feature actually works):

https://bugs.launchpad.net/ipython/+bug/382638

Thanks for the report!

Cheers,

f

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Reply all
Reply to author
Forward
0 new messages