[ESS] launch help.start() in EWW browser

Naresh Gurbuxani n@re@h_gurbux@n| @end|ng |rom hotm@||@com
Wed Sep 10 12:42:59 CEST 2025


On Windows emacs GUI, this function works as expected.  It opens http://127.0.0.1:23849/doc/html/index.html

 It does not work in Linux terminal emacs run inside AWS SageMaker.  Here it needs to open /home/ec2-user/anaconda3/envs/R/lib/R/doc/html/index.html

 I can open above location by running the elisp command
(eww-open-file "/home/ec2-user/anaconda3/envs/R/lib/R/doc/html/index.html”)   

I can get this location by running R command
> paste0(Sys.getenv("R_HOME"), "/doc/html/index.html”)

So the function ess-eww needs to find out if it is in a Linux terminal.  If yes, then it needs to apply a different logic. 

In R session, browser option has not been set up.
> help.start() 
Error in help.start() : invalid browser name, check options("browser").
!> options("browser”) 
$browser [1] ""

On Mac emacs terminal, this function works as expected.  In R session, browser option is already set up.
> help.start() 
Error in help.start() : invalid browser name, check options("browser").
!> options("browser") $browser [1] ""

On Mac emacs GUI, this function does not work with default settings.  This is the message displayed in in *eww* buffer:
Loading http://127.0.0.1:ting httpd help server ... done
[1] 23824/doc/html/index.html…

In *Messages* buffer:
Contacting host: 127.0.0.1:ting httpd help server ... done
[1] 23824:80
open-network-stream: 127.0.0.1:ting httpd help server ... done
[1] 23824/80 nodename nor servname provided, or not known


In R session, options(“browser”) is not set by default.  After setting up browser, M-x ess-eww opens the desired location. 
> options("brower")
$brower
NULL

> options(browser = "/usr/bin/open”)

Once again, I was able to open the desired location by running the lisp command
(eww-open-file "/Library/Frameworks/R.framework/Resources/doc/html/index.html”)

Once again, I can get this location by running R command
paste0(Sys.getenv("R_HOME"), "/doc/html/index.html”)

Thanks,
Naresh



> On Sep 8, 2025, at 10:04 PM, Tyler Smith via ESS-help <ess-help using r-project.org> wrote:
> 
> On Fri, Sep 5, 2025, at 6:17 AM, Naresh Gurbuxani via ESS-help wrote:
>> When running R in terminal emacs, what options are needed so that
>> help.start() opens EWW browser?
> 
> The following elisp code opens the R html docs in EWW, when called via `M-x ess-eww`.
> 
> It seems to work fine for me on Ubuntu Linux. If it works generally, I'd be happy to clean it up for inclusion in ESS.
> 
> Alternatively, if we accept running Emacs in daemon mode as a pre-requisite (i.e., meaning emacsclient is available), it's probably not too hard to find the proper syntax for the `browser` argument of `help.start()`. I looked at that too, but then this approach presented itself. It has the advantage of not needing the emacsclient server.
> 
> Let me know if this looks useful!
> 
> - tyler
> 
> 
> ```
> (defun ess-eww ()
>  (interactive)
>  (let ((BUF (generate-new-buffer "URL"))
>        (PORT)) 
>    (ess-command "print(tools::startDynamicHelp(NA))" BUF)
>    (with-current-buffer BUF
>      (setq PORT (buffer-substring 5 (point-max))))
>    (kill-buffer BUF)
>    (eww (concat "http://127.0.0.1:" PORT "/doc/html/index.html"))))
> ```
> 
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list