[ESS] launch help.start() in EWW browser
Tyler Smith
ty|er @end|ng |rom p|@nt@rum@c@
Wed Sep 10 17:00:45 CEST 2025
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
More information about the ESS-help
mailing list