[ESS-bugs] help() failing under R-devel [FWD Douglas Bates]

Martin Maechler maechler at stat.math.ethz.ch
Mon Oct 26 14:09:03 CET 2009


>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>>     on Mon, 26 Oct 2009 09:26:15 +0100 writes:

    MM> "We" may have overlooked this reply from Doug Bates to
    MM> ESS-help, mentioning a new, pretty important problem:


    MM> ------- start of forwarded message ------- From: Douglas
    MM> Bates <bates at stat.wisc.edu> Sender:
    MM> ess-help-bounces at stat.math.ethz.ch To:
    MM> ess-help at stat.math.ethz.ch Subject: [ESS] no S4 help
    MM> under Windows XP Date: Wed, 21 Oct 2009 08:47:25 -0500

    MM> I forgot to cc: the list on this reply.


    MM> ---------- Forwarded message ---------- From: Douglas
    MM> Bates <bates at stat.wisc.edu> Date: Wed, Oct 21, 2009 at
    MM> 8:46 AM Subject: Re: [ESS] no S4 help under Windows XP
    MM> To: Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>


    MM> On Tue, Oct 20, 2009 at 4:32 PM, Stephen Eglen
    MM> <S.J.Eglen at damtp.cam.ac.uk> wrote:
    >>> I installed Goulet's package awhile ago, and am running
    >>> ESS 5.3.10, emacs 22.3.1 and R 2.8.1.  I started an R
    >>> session with M-X R.  I don't think I've made any
    >>> customizations to R/ESS.
    >>> 
    >>> ?setClass or ?Classes gets me an empty buffer
    >>> *help[R](setClass)*.
    >>> 
    >>> Could anyone suggest a solution or diagnosis?  (Well,
    >>> other than my short-term fix of working in Linux--the
    >>> data I'll need is on Windows and needs to stay there).
    >> 
    >> hi Ross, can I just confirm -- you find that
    >> 
    >> ?setClass
    >> 
    >> works on linux
    >> 
    >> but not on windows?
    >> 
    >> Does life get any easier if you add:
    >> 
    >> (setq inferior-ess-r-help-command "help(\"%s\",
    >> htmlhelp=TRUE)\n")
    >> 
    >> to your .emacs which should then start help windows in a
    >> web browser?

    MM> Not to hijack the thread but the default
    MM> inferior-ess-r-help-command fails under R-devel (2.11.0
    MM> development version) where the arguments to 'help' are

    >> args("help")
    MM> function (topic, package = NULL, lib.loc = NULL, verbose
    MM> = getOption("verbose"), try.all.packages =
    MM> getOption("help.try.all.packages"), help_type =
    MM> getOption("help_type")) NULL

    MM> It gets a bit tricky to decide what expression you
    MM> should use for a ...r-help-command when

    MM> help("help")

    MM> fails.

    MM> ______________________________________________
    MM> ESS-help at stat.math.ethz.ch mailing list
    MM> https://stat.ethz.ch/mailman/listinfo/ess-help -------
    MM> end of forwarded message -------


    MM> So, Doug, and from ESS-core at least Kurt and me, as
    MM> R-developers, often working with 'R-devel' do need a
    MM> different setting than the default

    MM> (defcustom inferior-ess-r-help-command "help(\"%s\",
    MM> htmlhelp=FALSE)\n" "Format-string for building the R
    MM> command to ask for help on an object.

    MM> This format string should use %s to substitute an object
    MM> name.  If set, changes will take effect when next R
    MM> session is started."  :group 'ess-command :type 'string)

    MM> --- in lisp/ess-cust.el ---

    MM> namely something like

    MM>        "help(\"%s\", help_type="text")\n"
 

    MM> which works from R 2.10.0 (which is released *today* !)
    MM> and is compulsory from R 2.11.x on which is the current
    MM> "R-devel" version.

    MM> Consequently, the new default must depend on the R
    MM> version,....

    MM> *OR* we use our own little R code, and set the help
    MM> command to

    MM>        "helpESS(\"%s\", help_type="text")\n"

    MM> and under the hood, i.e., after startup of R, when we
    MM> know the R version, define helpESS() depending on the R
    MM> version.

    MM> Still a bit kludgy, but maybe the cleanest solution ??

I have implemented the above, using  .help.ESS  as function
name.
I've also upped the ESS version ___ of our "ESS-devel" ___ 
to 5.6
{This does not mean an immediate release, but it helps to see if
 I am using our ESS development version, or rather the released
 5.5 one}

Doug, if you don't like to work with the SVN version of ESS,
here's the necessary patch set to apply to the released version
of ESS :


Index: lisp/essd-r.el
===================================================================
--- lisp/essd-r.el	(revision 4188)
+++ lisp/essd-r.el	(revision 4189)
@@ -149,7 +149,18 @@
 	  (if ess-use-R-completion ;; use R's completion mechanism (pkg "rcompgen" or "utils")
 	      (progn ; nothing to happen here -- is all in ess-complete-object-name
 		(ess-write-to-dribble-buffer "resetting completion to 'ess-R-complete-object-name")
-		)))
+		))
+	  ;; problem with ess-help-command
+	  (let ((my-R-help-cmd
+		 (if (ess-current-R-at-least '2.10.0)
+		     "help"
+		   ;; else R version <= 2.9.2
+		   "function(..., help_type) help(..., htmlhelp= (help_type==\"html\"))")))
+
+	    (ess-eval-linewise
+	     (concat ".help.ESS <- " my-R-help-cmd) nil nil nil 'wait-prompt)
+	  ))
+
       ;; else R version <= 2.4.1
 
       ;; for R <= 2.1.x : define baseenv() :
Index: lisp/ess-cust.el
===================================================================
--- lisp/ess-cust.el	(revision 4188)
+++ lisp/ess-cust.el	(revision 4189)
@@ -1220,7 +1220,7 @@
 (make-variable-buffer-local 'inferior-ess-help-command)
 (setq-default inferior-ess-help-command "help(\"%s\")\n")
 
-(defcustom inferior-ess-r-help-command "help(\"%s\", htmlhelp=FALSE)\n"
+(defcustom inferior-ess-r-help-command ".help.ESS(\"%s\", help_type=\"text\")\n"
   "Format-string for building the R command to ask for help on an object.
 
 This format string should use %s to substitute an object name.


---------------------------

Martin



More information about the ESS-bugs mailing list