Re: [R] R command history -- can it be like Matlab's?

From: Gad Abraham <gabraham_at_csse.unimelb.edu.au>
Date: Sun, 03 Aug 2008 19:54:50 +1000

Peter Dalgaard wrote:

> Gad Abraham wrote:

>> Prof Brian Ripley wrote:
>>> A patch to do this was posted on 2007-09-29 by Glenn Davis. Some
>>> people not addicted to Matlab find the behaviour very inconvenient
>>> and prefer the getline/readline behaviour (triggered by ^R/^S) of
>>> Rterm and R on Unixen.
>>
>> Now that you've mentioned readline, it doesn't behave exactly the same
>> in Bash and R: if you press ctrl-r and then ctrl-c in Bash, it breaks
>> the search and you go back to the prompt as normal. In R on Linux (all
>> versions I've tried, 2.2 to 2.7.1), doing that returns you to the
>> prompt but you can't type anything, and the input buffer retains the
>> text from the search, so pressing enter makes the historical command
>> run again.
>>
>> Try this:
>> > ls()
>> character(0)
>> [ctrl-r]
>> (reverse-i-search)`l': ls()
>> [ctrl-c, then enter]
>> > ls()
>> character(0)
>>
>>
> Not quite true that you can't type anything. What happens (for me) is 
> that you are still in reverse-i-search, so you can get this effect from 
> "^R l ^C d".
> 
>  >
> (reverse-i-search)`l': ls()
> (reverse-i-search)`l': ls()
>  >
> (reverse-i-search)`l': ls()
> (reverse-i-search)`ld': levels(ftpain3) <- 
> list(none="none",intermediate=c("mild","medium"),severe="severe")
> 
> It snaps out of it if you press ^C twice.
> 

If try typing after a ctrl-C in reverse search mode , nothing displays, and the console beep sounds. It doesn't matter how many times I press ctrl-C, the same happens. The only way out of it is to press either enter (which shows the previously highlighted command ls and then runs it) or to use the up key, and then ctrl-C.

I'm using Ubuntu Hardy.

 > sessionInfo()
R version 2.7.1 (2008-06-23)
x86_64-pc-linux-gnu

locale:
LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

-- 
Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia
email: gabraham_at_csse.unimelb.edu.au
web: http://www.csse.unimelb.edu.au/~gabraham

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 03 Aug 2008 - 09:58:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 03 Aug 2008 - 12:33:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive