[Rd] Can't find linked HTML helpfile unless package is specified (PR#819)

kleiweg@let.rug.nl kleiweg@let.rug.nl
Sat, 20 Jan 2001 00:52:19 +0100 (MET)


I noticed this bug before in R 1.2.0. Can't remember whether it
was there in earlier versions.

    > help.start()
    Making links in ~/.R ...
    If /home/peter/sbin/netscape  is already running,       it is *not* restarted,
     and you must switch to its window.
    Otherwise, be patient..
    > help("help", package = "base")
    help() for help  is shown in browser /home/peter/sbin/netscape ...
    Use      help( help , htmlhelp=FALSE)
    or       options(htmlhelp = FALSE)
    to revert.
    > help("help")
    help() for help  is shown in browser /home/peter/sbin/netscape ...
    Use      help( help , htmlhelp=FALSE)
    or       options(htmlhelp = FALSE)
    to revert.
    Warning message:
    Using non-linked HTML file: style sheet and hyperlinks may be incorrect in: help("help")
    >

As you can see, a linked version of the helpfile is used if I
specify a package. But if I don't specify a package, the linked
helpfile is not found. The code in file "base" for function
help() that seems to generate this error is:

        lnkfile <-
            file.path(Sys.getenv("HOME"), ".R",
                      "library", package, "html",
                      paste(topic, "html", sep="."))

Since the variable packages at this point contains a list, the
variable lnkfile becomes a list.

This patch seems to solve the problem:


--- base	Mon Jan 15 18:01:16 2001
+++ base.new	Sat Jan 20 00:43:48 2001
@@ -10161,11 +10161,12 @@
                         ## we need to use the version in ~/.R if we can.
                             lnkfile <-
                                 file.path(Sys.getenv("HOME"), ".R",
                                           "library", package, "html",
                                           paste(topic, "html", sep="."))
-                            if (file.exists(lnkfile)) file <- lnkfile
+                            lnkfile <- lnkfile[file.exists(lnkfile)]
+                            if (is.character(lnkfile)) if (length(lnkfile) == 1) file <- lnkfile
                         }
                         if (file == ofile) {
                             warning("Using non-linked HTML file: style sheet and hyperlinks may be incorrect")
                         }
                         file <- paste("file:", file, sep="")



Another thing: is it absolutely necessary to print the same four
lines each time htmlhelp is used? Can't this be switches off
with an option like htmlquiet or something? Or don't print these
lines if verbose == FALSE.

--please do not edit the information below--

Version:
 platform = i586-pc-linux-gnu
 arch = i586
 os = linux-gnu
 system = i586, linux-gnu
 status = 
 major = 1
 minor = 2.1
 year = 2001
 month = 01
 day = 15
 language = R

Search Path:
 .GlobalEnv, package:ctest, Autoloads, package:base



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._