Emacs on my Mac got upgraded when I upgraded some other package in Homebrew and now working with Markdown files is very slow. I'm now running the railwaycat/emacsmacport/emacs-mac
package version with Emacs version 27.1. My markdown-mode is 20201211.329. Disabling markdown-mode makes the problem go away. I have run the profiler (in cpu mode) and gotten the following report:
+ redisplay_internal (C function) 7782 75%
+ command-execute 1850 18%
+ ... 443 4%
+ jit-lock--antiblink-post-command 162 1%
+ timer-event-handler 21 0%
+ #<compiled 0x421b5d07> 9 0%
+ gui-set-selection 4 0%
+ clear-transient-map 1 0%
Digging into redisplay_internal reveals the following:
- redisplay_internal (C function) 7782 75%
- jit-lock-function 7687 74%
- jit-lock-fontify-now 7687 74%
- jit-lock--run-functions 7681 74%
- run-hook-wrapped 7681 74%
- #<compiled 0x1feee74d43f1> 7681 74%
- font-lock-fontify-region 7671 74%
- font-lock-default-fontify-region 7671 74%
- font-lock-fontify-keywords-region 7663 74%
- markdown-match-italic 7418 72%
- markdown-match-italic 7295 71%
- markdown-match-italic 7282 70%
- markdown-match-italic 7267 70%
- markdown-match-italic 7132 69%
- markdown-match-italic 6999 68%
- markdown-match-italic 6884 67%
- markdown-match-italic 6764 65%
- markdown-match-italic 6656 64%
- markdown-match-italic 6556 63%
- markdown-match-italic 6454 62%
- markdown-match-italic 6446 62%
- markdown-inline-code-at-pos-p 5758 56%
- markdown-inline-code-at-pos 5757 56%
- markdown-match-code 5753 56%
- markdown-search-until-condition 5753 56%
apply 5752 55%
markdown-beginning-of-text-block 3 0%
markdown-end-of-text-block 1 0%
In short, Emacs appears to be spending looking for the following regular expression in order to identify inline code blocks:
"\\(?:\\`\\|[^\\]\\)\\(?1:\\(?2:`+\\)\\(?3:\\(?:.\\|\n[^\n]\\)*?[^`]\\)\\(?4:\\2\\)\\)\\(?:[^`]\\|\\'\\)"
I know much more than when I posted v1 of this question but I'm still not sure--how do I fix this?
+
sign reveals for theredisplay_internal
section? Maybe it's helpful, maybe it's not ....+
due to lack of familiarity with the profiler.