I use polymode when editing Rmarkdown files in Emacs 26.1 and have the following problem. I visit a new file, test.Rmd
, and type the following at the top of the file (this creates a yaml chunk):
--- ;; self-insert-command * 3
RET ;; markdown-enter-key
--- ;; self-insert-command * 3
C-a ;; move-beginning-of-line
RET ;; markdown-enter-key
C-p ;; previous-line
123 ;; self-insert-command * 3
C-n ;; next-line
C-e ;; move-end-of-line
RET ;; markdown-enter-key
123 ;; self-insert-command * 3
RET ;; markdown-enter-key
The result is that the text inside the chunk displays and is entered right to left, which is backwards; outside the chunk it is entered left to right, as expected. This is what I see and this is also how the file is saved:
---
321
---
123
I first encountered this with Emacs 26.2 under Ubuntu 18.04, but I was able to reproduce it with a fresh install of Emacs 26.1 in Ubuntu 19.04. Here is the complete .emacs:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
(custom-set-variables
'(package-selected-packages (quote (poly-R poly-markdown poly-noweb polymode))))
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(require 'poly-R)
(require 'poly-markdown)
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
And here are the contents of the elpa directory:
archives
gnupg
markdown-mode-2.3
poly-markdown-0.1.5
polymode-0.1.5
poly-noweb-0.1.5
poly-R-0.1.5
This also happens with the latest available versions of these packages and it also sometimes happens with R chunks.
M-x report-emacs-bug
. – Drew May 3 at 17:34