Re: launch help.start() in EWW browser
Tyler Smith via ESS-help <[email protected]> Wed, 10 Sep 2025 11:00:45 -0400
| Newsgroups | gmane.emacs.ess.general |
|---|---|
| Message-ID | <[email protected]> |
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 ht=
tp 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 ve=
rsion 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=E2=80=A6
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 t=
hat:
```
(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\\] ") (poin=
t-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 te=
rminal Emacs (on Debian).
Question for the ESS devs - is there a simpler way to get text from the R p=
rocess 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 fu=
ssing 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 int=
o an Elisp variable that would be better.
- tyler
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help