[Rd] readline operate-and-get-next
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Aug 12 19:25:23 CEST 2010
On Sun, 8 Aug 2010, Rafael Laboissiere wrote:
> Okay, I could not refrain myself and implemented the change in
> src/unix/sys-std.c. The patch is attached below. I tested it in the
> 2.11.1 source and it worked fine. At any rate, the patch applies cleanly
> to the SVN source.
>
> Three notes about this patch:
>
> 1. The code is taken from the bash source (bashline.c) with minimal
> changes.
Hmm, one of those 'minimal changes' was to omit the copyright and
licence statements. I very much doubt that you have the right to post
copied code without those, and we certainly do not have the right to
use such code in the R sources.
Bash is currently distributed under a licence that FSF deems
incompatible with that of R, and we would only accept code which can
be (re-)licensed under GPL (>=2). So it is critical where exactly you
copied this from.
We can only consider code contributions where the provenance and
licensing of the code is clearcut. That includes your own
contributions, and since you posted from an address which is likely to
be your employer, who owns the copyright of your work needs to be
clear too.
If you provide a patch with these extremely important issues resolved,
we will consider its merits. But not otherwise.
>
> 2. The changes are put inside #ifdef HAVE_READLINE_HISTORY_H, because
> it uses history related functions.
>
> 3. In the call to rl_add_defun, the operate-and-get-next function is
> bound to C-o. This is not the behavior of Bash and Octave, which
> depends on the user to define the key binding in ~/.inputrc. To
> mimic this behavior, the code should be rather:
>
> rl_add_defun ("operate-and-get-next", operate_and_get_next, -1);
>
>
> Best regards,
>
> Rafael Laboissiere
>
> * Rafael Laboissiere <rafael.laboissiere at inserm.fr> [2010-08-07 13:07]:
>
>> Both Bash and Octave have a nifty addition to the readline library called
>> "operate-and-get-next", bound to "C-o". This function accepts the
>> current line for execution and fetch the next line relative to the
>> current line from the history for editing (see
>> http://www.faqs.org/docs/bashman/bashref_101.html).
>>
>> This feature has a huge impact in my productivity using Bash and Octave
>> interactively, since it avoids those numerous arrow key strokes in order
>> to rerun a previous block of commands.
>>
>> I looked at the Bash sources and it does not seem too complicate to
>> implement. Octave has borrowed practically the same code from Bash.
>> Before I start looking at the R code, I would like to know whether the R
>> developers had already planned to include the operate-and-get-next
>> feature into R.
>>
>> Best regards,
>>
>> Rafael Laboissiere
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list