# Tag Info

6

Following the example at https://github.com/vspinu/polymode/tree/master/modes: (require 'polymode) (defcustom pm-inner/python (pm-hbtchunkmode "python" :mode 'python-mode :head-reg "\\\\begin{pycode}" :tail-reg "\\\\end{pycode}") "python typical chunk." :group 'innermodes :...

5

I ran into a similar issue, and wrote a stand-alone function to get around the weird interactions between yasnippet and polymode. The following function mimics the behaviour of the snippet you tried, prompting first for the header info, which gets inserted at your $1, and then dropping you in the chunck body (your$0): (defun tws-insert-r-chunk (header) ...

3

The error is simple: the polymode package does not define any polymode-mode-map (nor polymode-mode for that matter). Instead it defines polymode-minor-mode and corresponding polymode-minor-mode-map.

3

This is implemented now in Emacs 27 and available by default using the variable diff-font-lock-syntax.

3

After some trials on Windows machine, I found this workflow works very well: Installation for Windows users Step 1 Put this in your init.el or .emacs.el file - after ESS code: (require 'poly-R) (require 'poly-markdown) (add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode)) ;;; MARKDOWN ; (add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode)...

2

You need to add poly-noweb+r-mode to auto-mode-alist for Rnw files. You also need to watch for conflicts with ESS. ESS adds its own mode to auto-mode-alist for Rnw files, so you have to wait until after this happens to make sure you over-ride the ESS settings. This is what I have in my .emacs: (require 'polymode) (require 'poly-R) (eval-after-load 'ess-site ...

1

The reason I was having this problem is that I didn't have (require 'poly-R) in my init file. I only had (require 'poly-markdown). After adding (require 'poly-R), I can now press Enter within a chunk and it will stay in ess-r-mode.

1

I had the same issue but now it should be fixed in the development version.

1

If you have an active R process in your Emacs session, then the knitr-ESS weaver will use that process, as you've noted. That means any objects you create in your R chunks in your Rnw or Rmd document are available for interactive inspection (or even modification, although you most likely wouldn't want to do that) in the R buffer.

Only top voted, non community-wiki answers of a minimum length are eligible