Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs - help() output in web-browser

Tags:

browser

emacs

r

ess

I started using Emacs (ESS) as a default R editor (yes, @Dirk, as you've said, I want ESS), and I must admit it's by far the best R editor I've been using so far. However, I cannot manage to get an output of help() function up to web browser. It keeps displaying help page in a separate R buffer, even if options(help_type = "html", browser = "firefox") are set.

How can I get help back to browser, while using Emacs/ESS?

like image 544
aL3xa Avatar asked Jan 24 '26 04:01

aL3xa


1 Answers

I can reproduce this under Linux: If I run R from the terminal, setting options(htmlhelp=TRUE) brings up help in a browser, but it fails from ESS. However,

help("plot",htmlhelp=getOption("htmlhelp"))

works -- help opens in Firefox for me. I think that's an anomalous behavior -- htmlhelp=getOption("htmlhelp") is a default argument for help (see ?help). Could it be a bug?.. A possible workaround is to invoke help via help("plot",htmlhelp=T) directly, or write a wrapper like myhelp <- function(x) help(x,htmlhelp=TRUE).

EDIT: A possible solution: put this into your .emacs

(setq inferior-ess-r-help-command "help(\"%s\", htmlhelp=TRUE)\n")

as per https://stat.ethz.ch/pipermail/ess-debian/2009-October/000093.html. This refers to ESS 5.5; the current one in Ubuntu repositories is 5.4, so I can't test the fix w/o upgrading ESS.

EDIT2: I upgraded to the latest R/ESS as per Dirk's suggestion, and did the following, after launching R/ESS: M-x customize-variable inferior-ess-r-help-command and replaced help_type=text with help_type=html. That fixed things (at least for version 2.10.1/ESS 5.8).

like image 100
10 revs, 2 users 96%Leo Alekseyev Avatar answered Jan 25 '26 21:01

10 revs, 2 users 96%Leo Alekseyev