[ESS] Emacs, ESS and Rmarkdown: Is this the way compile is supposed to work?

Tyler Smith ty|er @end|ng |rom p|@nt@rum@c@
Fri Apr 21 17:09:43 CEST 2023


Hi Kevin,

If you have an older version of `poly-R`, the function `poly-gfm+r-mode` might not be present. This was added to `poly-R` dev in July 2021, I'm not sure exactly when it would have been added to the released version.

If that's the case, updating to the current version of `poly-R` should fix the problem.

Alternatively, you need the following code evaluated *after* `(require 'poly-R)` and *before* `(add-to-list ...)`:

```
(define-polymode poly-gfm+r-mode poly-markdown+r-mode 
  :lighter " PM-Rmd(gfm)"
  :hostmode 'poly-gfm-hostmode)
```

But that really shouldn't be necessary.

Best,

Tyler
-- 
plantarum.ca

On Fri, Apr 21, 2023, at 10:58 AM, Kevin Zembower via ESS-help wrote:
> Tyler, thanks for your response. I had found your website while 
> searching for a solution to my problem.
>
> Currently, I have this in my .emacs.d/init.el file:
> (setq load-path (append '("~/.emacs.d/polymode/" 
> "~/.emacs.d/polymode/modes") load-path))
> (require 'poly-R)
> (require 'poly-markdown)
> (add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
>
> This has been working for me without error so far.
>
> I commented out the last line and added this one:
> (add-to-list 'auto-mode-alist
>                '("\\.[rR]md\\'" . poly-gfm+r-mode))
>
> When I save my init.el file and restart Emacs with a .Rmd file, I get 
> this error message:
>
> File mode specification error: (void-function poly-gfm+r-mode)
> Package cl is deprecated
>
> I'm using GNU Emacs 27.1, with rmarkdown 2.21. I'm not able to install 
> or find a poly-R or polymode package for this version of R
>
> Any ideas what I'm doing wrong? Thanks for any help and guidance.
>
> -Kevin
>
>
> On 4/21/23 06:00, ess-help-request using r-project.org wrote:
>> Message: 2
>> Date: Thu, 20 Apr 2023 13:55:19 -0400
>> From: "Tyler Smith"<tyler using plantarum.ca>
>> To: ESS-help<ess-help using r-project.org>
>> Subject: Re: [ESS] Fwd: Emacs, ESS and Rmarkdown: Is this the way
>> 	compile is supposed to work?
>> Message-ID:<98fe4222-3e4f-408a-8773-bde2cf87b354 using app.fastmail.com>
>> Content-Type: text/plain; charset="us-ascii"
>> 
>> Hi Kevin,
>> 
>> You should be able to do what you want directly from the `.Rmd` buffer. I posted a tutorial here:
>> 
>> https://plantarum.ca/2021/10/03/emacs-tutorial-rmarkdown/
>> 
>> With the right packages installed, from the .Rmd buffer you can export your file with `M-n e`, select `markdown` and `html` when prompted, and the html will be generated and opened in a web browser.
>> 
>> The tutorial walks you through the steps in more detail.
>> 
>> Best,
>> 
>> Tyler
>> 
>> -- plantarum.ca
>
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list