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

Sebastian Meyer @eb@meyer @end|ng |rom |@u@de
Wed Sep 10 18:58:42 CEST 2025


I just noticed there is a related function already in ESS: 
ess-rutils-html-docs ("Use ‘browse-url’ to navigate R html 
documentation."). It no longer seems to work though. From an ESS[R] 
buffer, I get 'Wrong type argument: stringp, nil' and from iESS I get 
'Search failed: "http://"'. Maybe that function can be resurrected?

Re the search-forward: Wouldn't it be more convenient to cat() rather 
than print() the URL/port?

	Sebastian Meyer


Am 10.09.25 um 17:00 schrieb Tyler Smith via ESS-help:
> On Wed, Sep 10, 2025, at 6:42 AM, Naresh Gurbuxani wrote:
>>   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
> 
> This is interesting. If it needs to open a local file, that suggests the http server is not started. Can you tell me what the output of `print(tools::startDynamicHelp(NA))` (run from within R) is in that situation? The new version of my function (below) may fix this.
> 
>> 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…
> 
> This is helpful! My original code didn't account for the extra text emitted when the http server is started the first time. The following should fix that:
> 
> ```
> (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 (search-forward-regexp "\\[1\\] ") (point-max)))
>        (message (buffer-substring (point-min) (point-max))))
>      (kill-buffer BUF)
>      (eww (concat "http://127.0.0.1:" PORT "/doc/html/index.html"))))
> ```
> 
> This may also fix the problem in the Linux terminal. It works here using terminal Emacs (on Debian).
> 
> Question for the ESS devs - is there a simpler way to get text from the R process into Elisp? I've used `ess-command`, and then collected the relevant info out of the buffer the result is printed to. This requires a bit of fussing to get to the value I want (via `search-forward-regexp`). That might be brittle. If I could directly transfer the first value of an R vector into an Elisp variable that would be better.
> 
> - tyler
> 
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list