[Rd] patch to add a menu item in Rgui for RSiteSearch
Liaw, Andy
andy_liaw at merck.com
Tue Apr 12 18:57:31 CEST 2005
Please consider adding the following to the next R release (I understand
that it's too late for R-2.1.0). It adds the menu item `Search R Site' in
the `Help' menu in Rgui (which calls RSiteSearch() on the input string).
Best,
Andy
--- R-beta/src/gnuwin32/rui.c 2005-03-06 09:41:40.000000000 -0500
+++ R-beta-new/src/gnuwin32/rui.c 2005-04-12 08:21:55.001824500 -0400
@@ -65,7 +65,8 @@
static menuitem msource, mdisplay, mload, msave, mloadhistory,
msavehistory, mpaste, mpastecmds, mcopy, mcopypaste, mlazy, mconfig,
mls, mrm, msearch, mhelp, mmanintro, mmanref, mmandata,
- mmanext, mmanlang, mmanadmin, mman0, mapropos, mhelpstart, mhelpsearch,
+ mmanext, mmanlang, mmanadmin, mman0, mapropos, mhelpstart, mhelpsearch,
+ msearchRsite,
mFAQ, mrwFAQ, mpkgl, mpkgm, mpkgi, mpkgil, mpkgu, /*mpkgb, mpkgbu,*/
mde, mCRAN, mrepos;
static int lmanintro, lmanref, lmandata, lmanlang, lmanext, lmanadmin;
@@ -485,6 +486,21 @@
}
}
+static void menusearchRsite(control m)
+{
+ char *s;
+ static char olds[256] = "";
+
+ if (!ConsoleAcceptCmd) return;
+ s = askstring(G_("Search R Site"), olds);
+ if (s && strlen(s)) {
+ snprintf(cmd, 1024, "RSiteSearch(\"%s\")", s);
+ if (strlen(s) > 255) s[255] = '\0';
+ strcpy(olds, s);
+ consolecmd(RConsole, cmd);
+ }
+}
+
static void menuapropos(control m)
{
char *s;
@@ -560,6 +576,7 @@
enable(msearch);
enable(mhelp);
enable(mhelpsearch);
+ enable(msearchRsite);
enable(mapropos);
enable(mpkgl);
enable(mpkgm);
@@ -579,6 +596,7 @@
disable(msearch);
disable(mhelp);
disable(mhelpsearch);
+ disable(msearchRsite);
disable(mapropos);
disable(mpkgl);
disable(mpkgm);
@@ -985,6 +1003,7 @@
MCHECK(mhelpstart = newmenuitem(G_("Html help"), 0, menuhelpstart));
if (!check_doc_file("doc\\html\\rwin.html")) disable(mhelpstart);
MCHECK(mhelpsearch = newmenuitem(G_("Search help..."), 0,
menuhelpsearch));
+ MCHECK(msearchRsite = newmenuitem(G_("Search R Site..."), 0,
menusearchRsite));
MCHECK(newmenuitem("-", 0, NULL));
MCHECK(mapropos = newmenuitem(G_("Apropos..."), 0, menuapropos));
MCHECK(newmenuitem("-", 0, NULL));
More information about the R-devel
mailing list