2

I am struggling with emacs constantly hanging as soon as I move the cursor into a code chunk in Rmd files. It spends about two seconds moving the cursor after I hit an arrow key. Can you help me get normal response times from Emacs, so I can get back to work, please?

I used (the update) at how to setup Knitr workflow in Emacs? and installed ess, polymode, and poly-R from melpa. I have poly-markdown installed too.

Much less annoyingly, but still odd and maybe related, I get hundreds of buffers as I navigate through an Rmd file. They each seem to associate with tiny bits of the code in R code chunks and are named like "file.Rmd[r]<443>" where 443 is an arbitrary number. I have tried disabling minor modes to see if that should help, but due to all these buffers, I can't test if that works. If I disable a mode and hit an arrow key the buffer changes, and I think the mode is back on.

When I run a cpu profiler, go into a code chunk and try to move around a bit, the resource usage looks like this

  • redisplay_internal (C function) 5835 88%
  • imenu-update-menubar 5819 88%
  • imenu--make-index-alist 5819 88%
  • imenu-default-create-index-function 5819 88% - imenu--generic-function 5819 88%
    • syntax-ppss 5764 87%
    • syntax-propertize 5755 87%
    • apply 5755 87%
    • pm-execute-syntax-propertize-narrowed-to-span 5755 87% - if 5755 87%
      • condition-case 5755 87%
      • save-excursion 5755 87%
      • if 5755 87%
      • progn 5751 87% - pm-map-over-spans 5751 87%
        • save-restriction 5751 87%
        • let* 5751 87%
        • while 5751 87%
        • let 4376 66% - pm-select-buffer 4376 66%
          • apply 4368 66%
          • #<compiled 0x171e73d> 4368 66%
          • apply 4368 66%
          • #<compiled 0x3ba675> 4368 66% + apply 4368 66% car 4 0%
        • save-excursion 1343 20% - funcall 1343 20%
          • #<lambda 0x78a6431> 1343 20%
        • setq 20 0%
        • while 4 0%
      • let* 4 0%
  • funcall 8 0% kill-this-buffer-enabled-p 4 0%
  • tool-bar-make-keymap 4 0%
  • ... 413 6%
  • command-execute 345 5%
  • timer-event-handler 4 0%
  • polymode-post-command-select-buffer 2 0%

I use Emacs 26.3 on ubuntu 20.04

This is the first lines from "C-h m" Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption Column-Number Cursor-Intangible Diff-Auto-Refine Eldoc Electric-Indent Ess-Elisp-Trace Ess-Roxy File-Name-Shadow Font-Lock Global-Eldoc Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Outline Poly-Markdown+R Shell-Dirtrack Show-Paren Tool-Bar Tooltip Transient-Mark

(Information about these minor modes follows the major mode info.)

ESS[R] mode defined in ‘ess-r-mode.el’: Major mode for editing R source. See ‘ess-mode’ for more help.

Let me know if I can provide more relevant information.

John Doe
  • 53
  • 2
  • Is this still a problem for you? If so, can you tell us what version of polymode you are using? This isn't normal behaviour, it may help to update to Emacs 27 if you can. – Tyler Oct 04 '21 at 17:44
  • Thanks @Tyler. I still have this issue. I think you are right I have to upgrade emacs. On a windows machine where I use emacs 27 I don't have these problems. – John Doe Jan 07 '22 at 20:35

0 Answers0