From seniorr@teleport.com  Mon Jun 14 23:09:00 1999
From: seniorr@teleport.com (seniorr@teleport.com)
Date: Tue, 15 Jun 1999 00:09:00 +0200 (MET DST)
Subject: readline/history size (PR#211)
Message-ID: <199906142209.AAA02065@pubhealth.ku.dk>

Full_Name: Russell Senior
Version: 0.64.0
OS: linux-2.2.x
Submission from: (NULL) (198.107.133.11)


It appears that the GNU readline history size is limited to 50 entries.  This 
is apparently occurring because R is not bothering to override the readline 
default value (from readline-4.0):

  ./history.c:59:#define DEFAULT_HISTORY_GROW_SIZE 50

It appears that it ought to be possible to override this from R by setting the 
readline variable `history_size' to another value.  I request that a
command-line
option be added for doing this.  The following is an *untested* patch:

--- src/unix/system.c~  Wed Mar 31 12:53:18 1999
+++ src/unix/system.c   Mon Jun 14 15:05:50 1999
@@ -580,6 +580,35 @@
                else
                    R_NSize = value;
            }
+#ifdef HAVE_LIBREADLINE
+#ifdef HAVE_READLINE_HISTORY_H
+           else if((value = (*av)[1] == 'h') || !strcmp(*av, "--histsize")) {
+               if(value)
+                   REprintf("WARNING: option `-h' is deprecated.  "
+                            "Use `--histsize' instead.\n");
+               if(!value || (*av)[2] == '\0') {
+                   ac--; av++; p = *av;
+               }
+               else p = &(*av)[2];
+               if (p == NULL) {
+                   REprintf("WARNING: no hsize given");
+                   break;
+               }
+               value = Decode2Long(p,&ierr);
+               if(ierr) {
+                   if(ierr < 0) goto badargs;
+                   REprintf("--histsize %ld'%c': too large", value,
+                            (ierr == 1)?'M':((ierr == 2)?'K':'k'));
+               }
+               if(value < 0)
+                  REprintf("WARNING: invalid history (hist)size '%d' ignored,"
+                           " using default = %d\n", value, history_size);
+               else
+                   history_size = value;
+           }
+            
+#endif
+#endif
            else {
                REprintf("WARNING: unknown option %s\n", *av);
                break;


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


readline/history size (PR#211)
seniorr@teleport.com