Org mode折叠之后出现卡顿的report

遇到了和https://www.zhihu.com/question/40158785一样的问题,当org文件很大而且层次比较多的时候,会出现卡顿。移动光标需要好几秒之后才动作。按照陈斌大神的方法跑了个report,目前关闭linum-mode可以临时解决,不知道有没有大神能给出更好的解决方法。

emacs版本25.1.1 macOS 10.11.6 使用的Spacemacs develop分支

以下是report内容

- linum-update-current                                            822  53%
 - linum-update                                                   822  53%
  - mapc                                                          822  53%
   - linum-update-window                                          822  53%
    - apply                                                       822  53%
     - ad-Advice-linum-update-window                              822  53%
        #<compiled 0x446dfac5>                                    427  27%
- command-execute                                                 564  36%
 - call-interactively                                             564  36%
  - funcall-interactively                                         564  36%
   - counsel-M-x                                                  423  27%
    - ivy-read                                                    403  26%
     - read-from-minibuffer                                       179  11%
      - ivy--exhibit                                               82   5%
       - ivy--format                                               41   2%
        - mapcar                                                   35   2%
           counsel-M-x-transformer                                 35   2%
        - ivy-format-function-default                               3   0%
         - ivy--format-function-generic                             3   0%
          - mapconcat                                               2   0%
           + #<compiled 0x557185df>                                 2   0%
        - select-window                                             2   0%
         - apply                                                    2   0%
          - ad-Advice-select-window                                 2   0%
           - evil-refresh-cursor                                    1   0%
              evil-set-cursor                                       1   0%
       - ivy--filter                                               37   2%
        - ivy--re-filter                                           36   2%
         - cl-remove-if-not                                        36   2%
          - apply                                                  36   2%
           - cl-remove                                             34   2%
            - apply                                                27   1%
             - cl-delete                                           20   1%
                #<compiled 0x45bcb2f1>                             16   1%
              #<compiled 0x45dac667>                                5   0%
          ivy--sort                                                 1   0%
       - ivy--insert-minibuffer                                     3   0%
          ivy--resize-minibuffer-to-fit                             3   0%
      - linum-update-current                                       24   1%
       - linum-update                                              24   1%
        - mapc                                                     24   1%
         - linum-update-window                                     24   1%
          - apply                                                  24   1%
           - ad-Advice-linum-update-window                         24   1%
              #<compiled 0x446dfac5>                               12   0%
      - #<compiled 0x4458f2fd>                                     18   1%
       - ivy--minibuffer-setup                                     18   1%
        - ivy--exhibit                                             18   1%
         - ivy--insert-minibuffer                                  16   1%
          - ivy--resize-minibuffer-to-fit                          16   1%
           - window-resize                                         16   1%
            - window--resize-mini-window                           16   1%
             - run-window-configuration-change-hook                 16   1%
              - linum-update-current                               16   1%
               - linum-update                                      16   1%
                - mapc                                             16   1%
                 - linum-update-window                             16   1%
                  - apply                                          16   1%
                   - ad-Advice-linum-update-window                 16   1%
                      #<compiled 0x446dfac5>                        9   0%
         - ivy--format                                              2   0%
          - mapcar                                                  2   0%
             counsel-M-x-transformer                                2   0%
        evil-escape-pre-command-hook                                9   0%
      - minibuffer-inactive-mode                                    5   0%
       - run-mode-hooks                                             5   0%
        - run-hooks                                                 5   0%
         - projectile-global-mode-enable-in-buffers                  5   0%
          - projectile-mode                                         5   0%
           - ad-activate                                            5   0%
            - ad-activate-advised-definition                        5   0%
             - ad-make-cache-id                                     5   0%
              - ad-arglist                                          5   0%
                 help-function-arglist                              5   0%
      + redisplay_internal (C function)                             1   0%
      - timer-event-handler                                         1   0%
       - apply                                                      1   0%
        - auto-revert-buffers                                       1   0%
         - auto-revert-handler                                      1   0%
            buffer-stale--default-function                          1   0%
     - ivy--reset-state                                             1   0%
      - ivy--filter                                                 1   0%
       - ivy--recompute-index                                       1   0%
        - ivy--preselect-index                                      1   0%
           cl-position                                              1   0%
     - ivy-call                                                     1   0%
      + #<compiled 0x43a86f95>                                      1   0%
    - smex-update                                                  15   0%
     - smex-rebuild-cache                                          15   0%
        sort                                                        6   0%
        mapatoms                                                    5   0%
        smex-convert-for-ido                                        1   0%
    - smex-detect-new-commands                                      5   0%
     - mapatoms                                                     5   0%
        #<compiled 0x4457292d>                                      5   0%
   - evil-previous-line                                            97   6%
    - evil-line-move                                               97   6%
     - previous-line                                               97   6%
      - line-move                                                  97   6%
       - line-move-1                                               97   6%
        + #<compiled 0x45952f71>                                   18   1%
   - evil-next-line                                                44   2%
    - evil-line-move                                               44   2%
     - next-line                                                   44   2%
      - line-move                                                  44   2%
       - line-move-1                                               44   2%
        + #<compiled 0x428291f5>                                   22   1%
- flyspell-post-command-hook                                      119   7%
 - flyspell-word                                                   10   0%
  - org-mode-flyspell-verify                                        3   0%
   - org-log-into-drawer                                            2   0%
    - org-entry-get                                                 2   0%
     - org-entry-get-with-inheritance                               2   0%
      - org-property--local-values                                  2   0%
         org-get-property-block                                     2   0%
   - org-element-at-point                                           1   0%
      org-get-limited-outline-regexp                                1   0%
    ispell-send-string                                              2   0%
  - flyspell-get-word                                               1   0%
   - ispell-get-otherchars                                          1   0%
    - ispell-get-decoded-string                                     1   0%
       ispell-decode-string                                         1   0%
+ timer-event-handler                                              12   0%
+ redisplay_internal (C function)                                  12   0%
+ yas--post-command-handler                                         6   0%
+ evil-repeat-post-hook                                             1   0%
+ global-hl-line-highlight                                          1   0%
+ ...                                                               0   0%

我在 org 下面就是关闭 linum-mode 的,其实我基本不开 linum-mode

我现在把org的linum-mode关了,但是不开行号不会不方便吗

完成不会,因为知道行号又能怎么样呢? 运行的时候报错了,告诉你哪一行出错了, 你用 goto-line 跳转一下就可以了啊

没有avy-word的话相对行号对于evil玩家还是比较重要的,3yy,3dd,SPC;2j,V2j什么的

关闭linum-mode后,折叠展开还是不流畅,不知道是何原因

用 emacs 自带的 profiler 查看 cpu 和内存报告,诊断其中原因

禁用linum-mode,启用nlinum-mode.

这两个或多或少都有问题……不如等原生行号吧